Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp917185ybz; Wed, 15 Apr 2020 22:28:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKefETRWDTzP9HqjIm0Yx1g6yGPaVKdbYutCuF4Y+xidbqYeHUvBNekbsFVu64g0whIzyrE X-Received: by 2002:a17:906:405a:: with SMTP id y26mr7879445ejj.31.1587014908607; Wed, 15 Apr 2020 22:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587014908; cv=none; d=google.com; s=arc-20160816; b=a5Py2Kir3fboj4oSasw7gDOwqFrGOyu+ytwgcC5QqsDA4gLWQ7lIyKI/AW8E0ac/St SZp/HuqXNwWqdimjP3/X+S0dgClrxqhTJvCwggSixOv80Vv1jIgGgQVe264Rqzjs9XSr T8ucrIg4oRqtouXUveo+hq87ZKihN1pgZ8/Bq4fV+WxHoatBoDeRvLTl/X1HJrYTJ8mp kyxhOWqaEjlIrUft/y6QXgb6rVl7JT/KIh77rl4yURrdN+WRSD87ZsjF0k+IoA7Qpuui XsBM2JNN5smvGTWNNgH5Bgwxcc+Nt6B3Z8GWQ8jN9h2Mg5Sp3ZWHMUW2sYl6Qk3r2rzz oIzg== 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 :dkim-signature; bh=whCb8irywOuOLwB8N8qhV6UwE4acib9+m+so6yyRikQ=; b=QZ5oXcyjYi2NVr7e60oBLzKyQOqSRj+Wzp73N3oyfgijTRF9QZSlnTqsNrVxRfqrIz c5TdSoa+whPnsn494NwxMwfwzUhJOrU3WmrivY3JfpKy2beytgTEzcMgPMb+8tQdikbn WGQRgnvuDqlZ7BgF4JCIsxPa1defiPEM42OtvoDxlWEEz0jRbRYfimLbx/69vcKhNnzh 1UvwETxBxuL+EdrkviG+v8yO+pTg1DzjiwJ96MoCXRqkldLxHuF0EtobEqteTIJveU1c U7P4cQKlKKFge0GGQEnVQtwH/pRSN833gQhwNdI+sRFEGjFLguRA7fjBCdc6ExXdmPmJ NvrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QELZQSbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u12si14467839edt.299.2020.04.15.22.28.05; Wed, 15 Apr 2020 22:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QELZQSbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2406579AbgDPF0w (ORCPT + 99 others); Thu, 16 Apr 2020 01:26:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2406053AbgDPF0m (ORCPT ); Thu, 16 Apr 2020 01:26:42 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C871DC061A0C for ; Wed, 15 Apr 2020 22:26:42 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 188so1093599pgj.13 for ; Wed, 15 Apr 2020 22:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=whCb8irywOuOLwB8N8qhV6UwE4acib9+m+so6yyRikQ=; b=QELZQSbXoSNyL/seMqWzdkBoeEd+0wFPXQobGjaol+a9xdYz27jWvpgenJ/Qdmuh/m /6B7BdeECI7p4ERE4F12hwfMTiJY8wNsI9rN0e+fFZedSRIAZxautnVTbXpeAAlaTFds mTgBqLd46BOYrLsQuhkmRedcbuwPV6rASchv1Uc9YVXdiYnFWNG/+tLuJUu4WNKB0osv WbLU4sLPwCk7Gs/cKlnu9km7uq+4vOUew5Hl+Q+HuWL7EKBPDSfjNWIJNUehyekMwt+5 z02QK4tYJxRzG0Yr9nBOsINJYteBRNWLmfzni5xwptZOPAtPYHaOFal1+rJXIRJbA3HJ wQBQ== 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; bh=whCb8irywOuOLwB8N8qhV6UwE4acib9+m+so6yyRikQ=; b=X7SGQX9uIRlJyMcoAleW4v5lBcXPSJCf+jQFKJ93HaG0uC8trTQXck5m630C5FBpIS JIB3GlDAnqpM5BxD+gNWSPZxHcqjcgHBLU5NLZcWXKf8bnlHA2OfsyUN3Y/mdB9w96EP Vm5gMplx2T5mqGMCJCmkY2a8TmM/vL/CFT9/vZkyDLis2GCwc9BJEuqJsfju4eHeDu8K +2llvCkAh35Jpfmwc+ptaU7Gi2/KISdPZBGrnx5Dbu4mk0TelWH40zqWc+40+xrJkP4S eocUW6oUjGHimLOsX3r9iZBwCqtxBTMwBXncMqi+OBnKJ5efhNUoTPoT/6JasTQiVnxJ /Rww== X-Gm-Message-State: AGi0PuZKzcrssw2aFA/QkIoJupFzx6ujbH2O8Zgz6lVdcGGiyjTt+ScQ /oG/wxrdKQEw2Akji4+Zb9Q= X-Received: by 2002:a63:8ec7:: with SMTP id k190mr6073705pge.163.1587014801882; Wed, 15 Apr 2020 22:26:41 -0700 (PDT) Received: from laptop.hsd1.wa.comcast.net ([2601:600:817f:a132:df3e:521d:99d5:710d]) by smtp.gmail.com with ESMTPSA id c21sm53699pjr.2.2020.04.15.22.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 22:26:41 -0700 (PDT) From: Andrei Vagin To: Vincenzo Frascino , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , Thomas Gleixner , Andrei Vagin , Dmitry Safonov Subject: [PATCH v3 0/6] arm64: add the time namespace support Date: Wed, 15 Apr 2020 22:26:12 -0700 Message-Id: <20200416052618.804515-1-avagin@gmail.com> X-Mailer: git-send-email 2.17.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allocate the time namespace page among VVAR pages and add the logic to handle faults on VVAR properly. If a task belongs to a time namespace then the VVAR page which contains the system wide VDSO data is replaced with a namespace specific page which has the same layout as the VVAR page. That page has vdso_data->seq set to 1 to enforce the slow path and vdso_data->clock_mode set to VCLOCK_TIMENS to enforce the time namespace handling path. The extra check in the case that vdso_data->seq is odd, e.g. a concurrent update of the VDSO data is in progress, is not really affecting regular tasks which are not part of a time namespace as the task is spin waiting for the update to finish and vdso_data->seq to become even again. If a time namespace task hits that code path, it invokes the corresponding time getter function which retrieves the real VVAR page, reads host time and then adds the offset for the requested clock which is stored in the special VVAR page. v2: Code cleanups suggested by Vincenzo. v3: use OPTIMIZER_HIDE_VAR() instead of inline assembly in __arch_get_timens_vdso_data. Cc: Vincenzo Frascino Cc: Thomas Gleixner Cc: Dmitry Safonov v3 on github (if someone prefers `git pull` to `git am`): https://github.com/avagin/linux-task-diag/tree/arm64/timens-v3 Andrei Vagin (6): arm64/vdso: use the fault callback to map vvar pages arm64/vdso: Zap vvar pages when switching to a time namespace arm64/vdso: Add time napespace page arm64/vdso: Handle faults on timens page arm64/vdso: Restrict splitting VVAR VMA arm64: enable time namespace support arch/arm64/Kconfig | 1 + .../include/asm/vdso/compat_gettimeofday.h | 11 ++ arch/arm64/include/asm/vdso/gettimeofday.h | 8 ++ arch/arm64/kernel/vdso.c | 134 ++++++++++++++++-- arch/arm64/kernel/vdso/vdso.lds.S | 3 +- arch/arm64/kernel/vdso32/vdso.lds.S | 3 +- include/vdso/datapage.h | 1 + 7 files changed, 147 insertions(+), 14 deletions(-) -- 2.24.1