Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3711385ybl; Sun, 15 Dec 2019 16:20:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxgUe0Z4vQsHSVyfT3vYiSyyQJfCehVYWDEbyUkXrVoCDXG8hL3ciJHEw/Z5sxILf0RUbhG X-Received: by 2002:a05:6830:95:: with SMTP id a21mr27342690oto.167.1576455640893; Sun, 15 Dec 2019 16:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576455640; cv=none; d=google.com; s=arc-20160816; b=wt1NxQdtxekawcAj9kK5o97BVoWUDB2eRGg2TMANgfNFOMRiiBrtOx0Q0I6Tf5seT4 iBbnGX5mvi210Epg3Ocwxl6p6sRkecjX5fjW5jr1piauCntST6EB0Ohg6V2hxL16Uaht mxkc47WXTM935vE4LrdplCBgRhT8TRiykvt7JP9Fcdjc9DGZCRmBVX7oAI5iEqqY62Hc dsRYQZ2wZBsc+1v/84vf4tZsiGAAiUDpvY+95SE+7oaziCVwsDUYPPTwkQXC4qGDnAnt 1SFXS+pndSQeWzCvtFrJfE3xQXAks3ta1sAl7nKaF0DstbbSStE3a8vQCH57hJEaa3FG 9EzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aZ6sGO0KS0Q8EYVwWz/tNENQC8GnXFZ6xRDHj7knL74=; b=qgHDtQJDn7QQzLW/c04VxfKEB/BPp99nAJOa83i8VA39sWDdEIPozhhnVlh3lCvoZm Als1Gyg1MSSgeYbEzTCc6jg8/0ApdjLq89+wmLxWjhDc/EmUwQvkj9AZ1gOV+zRCQ9cC bl046nEwFHLl5WKSeC38qLmPaWTHm5M8DGK/7us+MzPZPqA8C1BSGS8Q8rqftSVgX16a OfZR60K4ezrZMHoks2EWtlFp2JEYBWho6z/nW6oFLpeTgXrvRAfp+4ectciKM6EQAbrK KCxs6f4OuUhSZpr5D7Yl6cyJwW8OjF0cjarxib+VoKQQ9reDsjZW3Ic06eh3Sm/+k/64 RRZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gmb45a2r; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t134si8969993oie.148.2019.12.15.16.20.29; Sun, 15 Dec 2019 16:20:40 -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=pass header.i=@gmail.com header.s=20161025 header.b=Gmb45a2r; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbfLPATe (ORCPT + 99 others); Sun, 15 Dec 2019 19:19:34 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:36747 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbfLPATd (ORCPT ); Sun, 15 Dec 2019 19:19:33 -0500 Received: by mail-qk1-f194.google.com with SMTP id a203so2879665qkc.3; Sun, 15 Dec 2019 16:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aZ6sGO0KS0Q8EYVwWz/tNENQC8GnXFZ6xRDHj7knL74=; b=Gmb45a2redl2v2Psqc9UmK5BWjcPglzmbzjDpsikHLbmggLKdOVorJeLzaOihAp93n dZuMPP9Yq0XhR4kkhOpXSkhSDgDY7Q1xUpGZhMf6Ogg+p7xlsNEqI8pOq07smNJIb729 KRa4FwyruYu+W4RNN1PJgXm4h6Ulv+MJjNPQcDIV0FZh4+eA8lE6SlNe6p65GE7u3Z6k Wa+wg8XDsBh++bc/vo63jVSfEKICDmwU/S4INp786dJO2HHJnWsMRwktN9Y0UajVgbpm NrNsEFU0hxV8nLsegKRlsf3oghWVDY2nCi+m+2Fp1dRlscQL+URlyVJ1jR+XgzFXJbZM L3dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aZ6sGO0KS0Q8EYVwWz/tNENQC8GnXFZ6xRDHj7knL74=; b=RnErxtQUu6V8GQqcCT9cxw1Dzbfxy9Zw7qMz5LihiSqjC/2S6X5kVf8A4Y+u5ZfTrA niQFRWlZ6l55nxfTQuAVStRW6/vlP7gb30g0xVtsXAkgRpIq3tPxI3029ni0ZNUOAxVx luDeucZEPdigHlD6Q72Lo8/mPBNuUEvwwQYdlFXRhsb9uV8XfYgoDuQCL4u0KH6lawFB CpRLVpznKRwoLDW9okRfoTzH0dsilPI3/ZDd2ogC4GEaW+Ml3MlTmvlFQrJquCyhbU27 gQyLovPDUyGBUR+3TapqVNMQ6iUDyLll/g4Qcu4yETn8vesjlF1dG9Mlh3rJd9EgBvdb Sg5A== X-Gm-Message-State: APjAAAUJqh3LZLZTq5fdoQ53OmGLG4QRwumxoUMXEKbNBZ/x2z+LAALj tdOIBOzpXPI15skFakkhJ24= X-Received: by 2002:a37:48f:: with SMTP id 137mr24677846qke.25.1576455572728; Sun, 15 Dec 2019 16:19:32 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id e2sm5376739qkl.3.2019.12.15.16.19.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2019 16:19:31 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 7111D22430; Sun, 15 Dec 2019 19:19:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 19:19:30 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgggfestdek redtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgse hgmhgrihhlrdgtohhmqeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgpdhgihhthhhu sgdrtghomhenucfkphephedvrdduheehrdduuddurdejudenucfrrghrrghmpehmrghilh hfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieel vdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtg homhesfhhigihmvgdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 992E780062; Sun, 15 Dec 2019 19:19:28 -0500 (EST) From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Michael Kelley , Vincenzo Frascino , Catalin Marinas , Will Deacon , Thomas Gleixner , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , xen-devel@lists.xenproject.org, Stefano Stabellini , Boqun Feng Subject: [RFC 0/6] vDSO support for Hyper-V guest on ARM64 Date: Mon, 16 Dec 2019 08:19:16 +0800 Message-Id: <20191216001922.23008-1-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is the RFC patchset for vDSO support in ARM64 Hyper-V guest. To test it, Michael's ARM64 support patchset: https://lore.kernel.org/linux-arm-kernel/1570129355-16005-1-git-send-email-mikelley@microsoft.com/ is needed. Similar as x86, Hyper-V on ARM64 use a TSC page for guests to read the virtualized hardware timer, this TSC page is read-only for the guests, so could be used for vDSO data page. And the vDSO (userspace) code could use the same code for timer reading as kernel, since they read the same TSC page. This patchset therefore extends ARM64's __vsdo_init() to allow multiple data pages and introduces the vclock_mode concept similar to x86 to allow different platforms (bare-metal, Hyper-V, etc.) to switch to different __arch_get_hw_counter() implementations. The rest of this patchset does the necessary setup for Hyper-V guests: mapping tsc page, enabling userspace to read cntvct, etc. to enable vDSO. This patchset consists of 6 patches: patch #1 allows hv_get_raw_timer() definition to be overridden for userspace and kernel to share the same hv_read_tsc_page() definition. patch #2 extends ARM64 to support multiple vDSO data pages. patch #3 introduces vclock_mode similiar to x86 to allow different __arch_get_hw_counter() implementations for different clocksources. patch #4 maps Hyper-V TSC page into vDSO data page. patch #5 allows userspace to read cntvct, so that userspace can efficiently read the clocksource. patch #6 enables the vDSO for ARM64 Hyper-V guest. The whole patchset is based on v5.5-rc1 plus Michael's ARM64 support patchset, and I've done a few tests with: https://github.com/nlynch-mentor/vdsotest Comments and suggestions are welcome! Regards, Boqun