Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp803977imm; Wed, 19 Sep 2018 07:11:29 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda4cOMslsBrZxymaZFEIOijk5pvcrif4l3eosbkkMYSfN1UJBtj0P+hva46Dn3mnZPaHxse X-Received: by 2002:a17:902:b903:: with SMTP id bf3-v6mr7454306plb.309.1537366289412; Wed, 19 Sep 2018 07:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537366289; cv=none; d=google.com; s=arc-20160816; b=OWBVGCsW1udc/PXSGUF6wH7AVBrgmyORDtR4QktnoOrDqas4OTTWx/WogGTjvWXXeG xOP+gUXxru17ndYikn6vY14laFUrcjv+Iwpz/IdfMfDgpFGKE/c/bqN72+I8CiBlt6Ml 5pCDvaY7LjKofJmqVUMgtDcHbHJawO/39v3QBuSYiQaHPf7hNcOFtfvRMyM6G4Dh7CDt M3oB7h8R2XMHwSG13t6wdG6aJQ0gdbnsHdUA3ztrXbUNw2jz4rC3aQedP/P9FN++7gi9 B3nMo26rW6SWwXm7AYGPgHDjYvPJ2/Vfn+8nMOS+cBzcgTA6QuR/5K91IdYbz5QJQEIY VnLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Py8xIsrbz2ugRDknxOoilA46MWHcXsvnzPWoub0T4So=; b=BRVxknVq648khr0/4dNKjnKfyUsCo8jbdk1RxVe7ChrlMgjyK+7iXMoiZvIyPGX2Yb 31FKmt2OLftUAghDSqe9jf5l2G9TumekSaCiKymmkR0GsYKxbTlVjFuAfw4Icr4fVA5p d/UNyMLiVUySHDnMqXmmOjYK7qE3dT5BMTmCNO9h+Qd2VN6wKY/BLu7Dcc4DHdNLI8AW p98DuOrMCqfIiD/2S2msgZrCOtUO9Ru9hWvtqyFJiz53evHhzU6IYYniueTOTBv2Lwow lsgx7+EmDW46o0WXVVziq/tSfcRY3t/6DAWXGPuW/gFFEeoiok2zSpDbySAA/+Rbwl1m qU3Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2-v6si2020414pfl.171.2018.09.19.07.11.13; Wed, 19 Sep 2018 07:11:29 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732039AbeISTUh (ORCPT + 99 others); Wed, 19 Sep 2018 15:20:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:52992 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731391AbeISTUh (ORCPT ); Wed, 19 Sep 2018 15:20:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3AFF1ACDE; Wed, 19 Sep 2018 13:42:36 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: boris.ostrovsky@oracle.com, Juergen Gross Subject: [PATCH v2] xen: issue warning message when out of grant maptrack entries Date: Wed, 19 Sep 2018 15:42:33 +0200 Message-Id: <20180919134233.3040-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a driver domain (e.g. dom0) is running out of maptrack entries it can't map any more foreign domain pages. Instead of silently stalling the affected domUs issue a rate limited warning in this case in order to make it easier to detect that situation. Signed-off-by: Juergen Gross --- drivers/xen/grant-table.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 7bafa703a992..84575baceebc 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -1040,18 +1040,33 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, return ret; for (i = 0; i < count; i++) { - /* Retry eagain maps */ - if (map_ops[i].status == GNTST_eagain) - gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, map_ops + i, - &map_ops[i].status, __func__); - - if (map_ops[i].status == GNTST_okay) { + switch (map_ops[i].status) { + case GNTST_okay: + { struct xen_page_foreign *foreign; SetPageForeign(pages[i]); foreign = xen_page_foreign(pages[i]); foreign->domid = map_ops[i].dom; foreign->gref = map_ops[i].ref; + break; + } + + case GNTST_no_device_space: + pr_warn_ratelimited("maptrack limit reached, can't map all guest pages\n"); + break; + + case GNTST_eagain: + /* Retry eagain maps */ + gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, + map_ops + i, + &map_ops[i].status, __func__); + /* Test status in next loop iteration. */ + i--; + break; + + default: + break; } } -- 2.16.4