From patchwork Wed Sep 22 08:21:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12509695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B421FC4332F for ; Wed, 22 Sep 2021 08:22:14 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E26961050 for ; Wed, 22 Sep 2021 08:22:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5E26961050 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.192237.342578 (Exim 4.92) (envelope-from ) id 1mSxVs-0004MR-Tw; Wed, 22 Sep 2021 08:21:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 192237.342578; Wed, 22 Sep 2021 08:21:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSxVs-0004MK-Qv; Wed, 22 Sep 2021 08:21:56 +0000 Received: by outflank-mailman (input) for mailman id 192237; Wed, 22 Sep 2021 08:21:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSxVr-0004ME-4J for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 08:21:55 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d3f31747-cd10-4295-a5cf-4c9efeefc486; Wed, 22 Sep 2021 08:21:53 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d3f31747-cd10-4295-a5cf-4c9efeefc486 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632298913; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=KvlRs63Cx+Jvx4nNBqIkILrlJjUxHNtbkim4lAXRCe8=; b=c+gTB/FRcbo5acUYLMpatTJm5x98BGAYMSy+Q67Te4cqGfiWilAgi1Lz kwFHGWGW3G230pWIud+rNwUV6wY7gil6AKSm5TF/gXlTqyib5EQsWtbVz +pc3208rajXTXpBpi04c5cqhtrj9amN52kqmAv1xNl6pwA5B6SfoGMQOF E=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: IDblU9qmfXikEPp8GctaHMIy18ZtDSb5xCLFEX0CVudyjJix0RqPbadI5AgIvonUTL52uvlhl4 a6ex4/Vfcv3bwX8e2M5zoMW94MxKbUoMJnrWiuJKSM1aj/eGQlQI5ZPLr4qeukeWTaTVlEcg/b 2ZxHdkHhiB7nqheC9sesO2Rzmk6w0xqz7sjOWFiVMTuOEulNU46IxK/FAXAjxK0Wx3uxNVrO91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Rj4NQdRXUr2A6ustn7a 5N12WF87JKEBLphk3Glpj1fiAvsnDxjWspkOYVgXAae5AZcqVtoYsW+14QOIscHRj99JssHI BVfYDhDc5tABGnhk3izyxSKITGZAV2Iv7GeDlNhiWt6UkUoJgjpHFog/D2nR87hdsAotd/lq L52gkBrsA7ciYsV9MOOA42e7rANoX8e2O+DIusGyWTKEh+AQO0l3fW2sR/2Aj4Qu1D8HMN8K 6xJ2+w81RCIn7TNQ== X-IronPort-AV: E=Sophos;i="5.85,313,1624334400"; d="scan'208";a="53315430" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZhLjhOMPDYiYOtBcyO2HEUeAYNvrcM5dhfeIUy+QLs7kaEWe52aTLcv4WaG93gCxtCIQ6StY5BuQArA8SbQ4BhUEyp9QAejSB3M9GcWXiMhwoNcki+culN/MWcxKZCqgKsDDvYuerfuji2/JWJiZXvXyRlXrsUp48JcBCJ1tQNh6AJ+wgZgUk7ONi2o0At/C/2ufiDiARIw1ta796cSd6p2XVple/2gJtiv0LnlkNEL+BowmADNKy8reIDMiRhAgLHZQlQikVmM97+DlxL60lTc16DVXT9R6qOUjhgYPCvEl/NxL3JiKwvyv5CvCMElBy/WNvVx6PGGPT5rAPsAlhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p6U9+CcoG+mX2fECvTxGB38bv2Hcg2ZxfYzHOKtfzAE=; b=W6AD/rIiqS1Wdj9hwk2VvkOfrh4Vf0jCKuByWPSvg0fEhXqbwaTsO2WamWaBWnQUMqdwgX6zqx8mRV3bhfOGoYxACqfYWj13vx2Z2Z+k5QDnR3L/JQ5cMG61MexAq1y9lEpZHXU0OfIDNr5cCqo4wvVdY0yrBK0EsSCTLCBzLsvuswmrt68GS3hLsCT7H3T2vbCafpsaNHwzKSXysPMdJ5flMgO+oj2SA30BkHS2ORFyaGGFrmGJYSojSXbX2ot3nsAv/cTEFUt9xkW5moRVBHR9krxtz3+qF3m86+sX3YSM7WSw4pYsPi9b61F/Joi2ndUhuf3o4eYH+dEx1j4yxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p6U9+CcoG+mX2fECvTxGB38bv2Hcg2ZxfYzHOKtfzAE=; b=QDWXLIz5g7Bjj82bvzImjkxuV0oXOJZn8vdK7+W3op157Ds2cpG73W/oymE7nh0Ju/5E38Zl5pjajwnZ418hh947+T/z234qYkfjnAbBaAmjx95Ew0UAB8fjWb2asvN0HGxJteFqSHoErU4jCe9y9AB8xN+fioQ5gVS9a4FCCyY= From: Roger Pau Monne To: CC: Roger Pau Monne , Ian Jackson , Wei Liu Subject: [PATCH v2 1/6] tools/console: use xenforeigmemory to map console ring Date: Wed, 22 Sep 2021 10:21:18 +0200 Message-ID: <20210922082123.54374-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210922082123.54374-1-roger.pau@citrix.com> References: <20210922082123.54374-1-roger.pau@citrix.com> X-ClientProxiedBy: LO2P265CA0042.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::30) To SA0PR03MB5610.namprd03.prod.outlook.com (2603:10b6:806:b2::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5fcaec7-237b-49fd-71f0-08d97da205ff X-MS-TrafficTypeDiagnostic: SN6PR03MB4015: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TqDweZTz9JMoOtoEKoQPx6jqGFJUZJwquY9EgHbXTho4ZHCMjM18dJikjti3MYe8no3nHpDit77I7Ey399vRgY3p5LRQFO3oB0g9sc2lOUqjpF/HEcQ+zir12bkaOXHgvV4h0jqSJHnL4ENldXxWcqX91q4Yg5gIERvlgjs0OF3Oxz/J7nG+wak9plZLQsNAcBgg3ECwr9BSCq7domv1ENabkgHrV9Zth9BDTjYYi+GoywV+jjYLPKFhz6ohPU3bONLxILsjsPzSHZi234zOTiwZeiUu/ywMrNuucmFn6t+3F2TsrW8G7YgOcLEIcJDQXFXIP0psDVJVdrSk8qdhLvCfg6umAzGIkA8LO3A+yjvVydmEyW3pe+hvim8EPuUfqf04uX7RvRv9cHI34VtPUyytqtEiV4z1sR7g3Ez44buEOtpPgK7vIHp7DD0+aukEt5jToGhZ082+Exlz4IsLNjcgTtnKTJr9obHi04sGqn8GKetPY8rcmLHYuZ5aNyofdhy+xv3bxBrDThpogKSFdI001oj2tY7AWF+aOXqacOO0Dp7O+3onS3TkY6OK+bc42/R/yUIrjAwF4JpBTLioFjFI8BzFpBcHT8AKzczaEZKwG7nJVUE2KdJYu1FtpsTNPaU8h6Og5Lve36s08JJ0EQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR03MB5610.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66476007)(66556008)(66946007)(4326008)(38100700002)(8936002)(186003)(956004)(86362001)(2616005)(8676002)(508600001)(54906003)(83380400001)(6496006)(26005)(6916009)(2906002)(6666004)(5660300002)(1076003)(6486002)(36756003)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lIAA+YDdAIhYZUTe1w56YC9RRIHV?= =?utf-8?q?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F?= =?utf-8?q?oCXn6IkGp+3x6sQOK9c5EprW58/wf5sm3w/Uh3QBm7mHUZGayJIINYGCsQdGu17Wm?= =?utf-8?q?22DVEpPq0a/fjbDUZp0arlbadmQCZNmnZGsfPpQ+lOBalFFYZzE3GCo0OLewDYfJz?= =?utf-8?q?qI0ydYlxIxMxQ44IaSlM2P7q36fpYKg/r6WZpX8vyPkDxzBxeVIoZThSK5lAEia2I?= =?utf-8?q?LWIfPtyop4Q0IdkbWo/3MMfpvPZ3VnIlESMmEP/5Kz15AUKti8nIGyoLLxHBLISOf?= =?utf-8?q?PRrV77bpF8jtmVw8bAAUog1QIYFfpO0ldIf+F8wZciQd85raZmACygt3s5oPzhuzv?= =?utf-8?q?nq9SnxWgZShotpLBDYyxflT5mrjqXd42dcdtUUeePXXrg4guZefYCRcFiSznnWCSQ?= =?utf-8?q?C9fRHLGu6NDCKDR6?= X-MS-Exchange-CrossTenant-Network-Message-Id: f5fcaec7-237b-49fd-71f0-08d97da205ff X-MS-Exchange-CrossTenant-AuthSource: SA0PR03MB5610.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 08:21:49.0452 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +dMTkd1udyg6R+er5SXbtfgoY0j7YbR5kiIxnCiCuvwJaetRkpy0LTNTiNynxyS4HC8hqc/DiE0Y2+N+R1umYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB4015 X-OriginatorOrg: citrix.com This patch replaces the usage of xc_map_foreign_range with xenforeignmemory_map from the stable xenforeignmemory library. Note there are still other uses of libxc functions which prevents removing the dependency. No functional change intended. Signed-off-by: Roger Pau Monné Reviewed-by: Ian Jackson --- tools/console/Makefile | 4 ++-- tools/console/daemon/io.c | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tools/console/Makefile b/tools/console/Makefile index 84796eac8f..3f4cddab03 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -29,9 +29,9 @@ clean: distclean: clean daemon/main.o: daemon/_paths.h -daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CONSOLE_CFLAGS-y) +daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CFLAGS_libxenforeignmemory) $(CONSOLE_CFLAGS-y) xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) - $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS) + $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_libxenforeignmemory) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS) client/main.o: client/_paths.h xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c)) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 200b575d76..682c1f4008 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -22,6 +22,7 @@ #include "utils.h" #include "io.h" #include +#include #include #include #include @@ -73,6 +74,7 @@ static int log_time_guest_needts = 1; static int log_hv_fd = -1; static xengnttab_handle *xgt_handle = NULL; +static xenforeignmemory_handle *xfm_handle; static struct pollfd *fds; static unsigned int current_array_size; @@ -675,7 +677,7 @@ static void console_unmap_interface(struct console *con) if (xgt_handle && con->ring_ref == -1) xengnttab_unmap(xgt_handle, con->interface, 1); else - munmap(con->interface, XC_PAGE_SIZE); + xenforeignmemory_unmap(xfm_handle, con->interface, 1); con->interface = NULL; con->ring_ref = -1; } @@ -722,11 +724,12 @@ static int console_create_ring(struct console *con) con->ring_ref = -1; } if (!con->interface) { + xen_pfn_t pfn = ring_ref; + /* Fall back to xc_map_foreign_range */ - con->interface = xc_map_foreign_range( - xc, dom->domid, XC_PAGE_SIZE, - PROT_READ|PROT_WRITE, - (unsigned long)ring_ref); + con->interface = xenforeignmemory_map( + xfm_handle, dom->domid, PROT_READ|PROT_WRITE, 1, + &pfn, NULL); if (con->interface == NULL) { err = EINVAL; goto out; @@ -1341,6 +1344,14 @@ void handle_io(void) errno, strerror(errno)); } + xfm_handle = xenforeignmemory_open(NULL, 0); + if (xfm_handle == NULL) { + dolog(LOG_ERR, + "Failed to open xen foreign memory handle: %d (%s)", + errno, strerror(errno)); + goto out; + } + enum_domains(); for (;;) { @@ -1462,6 +1473,10 @@ void handle_io(void) xengnttab_close(xgt_handle); xgt_handle = NULL; } + if (xfm_handle != NULL) { + xenforeignmemory_close(xfm_handle); + xfm_handle = NULL; + } log_hv_evtchn = -1; }