From mboxrd@z Thu Jan 1 00:00:00 1970 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=-19.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL 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 3A647C4338F for ; Thu, 22 Jul 2021 19:34:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 227A760EB9 for ; Thu, 22 Jul 2021 19:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbhGVSx3 (ORCPT ); Thu, 22 Jul 2021 14:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbhGVSx2 (ORCPT ); Thu, 22 Jul 2021 14:53:28 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6185C061575 for ; Thu, 22 Jul 2021 12:34:01 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id k14-20020a05600c1c8eb02901f13dd1672aso3079756wms.0 for ; Thu, 22 Jul 2021 12:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jhYsOx1LWs0cX/jFmHSeQJdM5hC2M39ceQWiy7371d4=; b=KTUsRkXf4ffoeh8ZbMqm31lud2SqLwVvOFo7Cl2jnZ4J7pYL55bBrPIbwLHe7pbaIo QmdCWIukoUmVQDGqMENWtc6ektd6uNOD0Zx6uv2T51mssBNN+QkOjO2Kf02iUMGrSdFP rvHBMP34dGJ4DxuBpgwrmtNKsX0N6bwKa8S1iKjblT/SMsr/37cPbcPC5Qq4d2kyughj NRfdclkQgGSeOoeH2m4zQvPUyHu5Ljw7VTnHtEDlEu1QZCJVkS6wsAYhqdUjNad07ELy SvHcE1/bVW4/ZNw9ppykjxm++rFPjlt4PDvgUvZj5IpOG2vzz13X2TOIiU7OhY6ONeY1 Cvmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jhYsOx1LWs0cX/jFmHSeQJdM5hC2M39ceQWiy7371d4=; b=ML4rLY2tw80osTt6TKpA5FYQozIeiPp+QgnE5RPhxucBMcye5k/HxkmG9d87Fa9f7u EvMt/cDcAO+vC9xIz2Xjo7QJOrxcr9aH/MY22mADZ+ELLL2XCBiJUnTNo1aF/TiqnUw+ nTzXrmtLQCeYHxhs8v5S6T2jZClQ3MkHVdurxkK9mE3A4XLNwkBBLVrhK17s9RHH7uz/ dJFUzir19JaJsqBDR0CFPlbb6RlqkkiY/5B6gaP14NLkCq6YOWxL/YChMzTViuOFW2HZ e2HGcK+fyKBSyINH1x0I4L52seR1lhY+nV9gKExG39n0wANixOqM8E2QeKxUwJo4+aXt dX4A== X-Gm-Message-State: AOAM5319V+Z3NT0FBCyteZpg/FeQ6MbsMBu50JrRLbrWOezaXGoyg/wz bA3cmBnJq5/wpAnxQNCn7EqEiA== X-Google-Smtp-Source: ABdhPJzAV0SGTymmduCOhJtF1fux4J5JcXs5+NUVNCIiqHcjF/y0IV5ZQ7B4UnjMDgV+7PIFPHmd6A== X-Received: by 2002:a7b:c351:: with SMTP id l17mr1121772wmj.120.1626982440145; Thu, 22 Jul 2021 12:34:00 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:15:13:f1d2:f5fd:de90:c735]) by smtp.gmail.com with ESMTPSA id t6sm31102302wru.75.2021.07.22.12.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 12:33:59 -0700 (PDT) Date: Thu, 22 Jul 2021 21:33:52 +0200 From: Marco Elver To: Quentin Perret Cc: Shameerali Kolothum Thodi , Will Deacon , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "linux-kernel@vger.kernel.org" , "maz@kernel.org" , "catalin.marinas@arm.com" , "james.morse@arm.com" , "julien.thierry.kdev@gmail.com" , "suzuki.poulose@arm.com" , "jean-philippe@linaro.org" , "Alexandru.Elisei@arm.com" , Linuxarm , mark.rutland@arm.com Subject: Re: [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one Message-ID: References: <20210616155606.2806-1-shameerali.kolothum.thodi@huawei.com> <20210616155606.2806-4-shameerali.kolothum.thodi@huawei.com> <20210721163138.GD11003@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 22, 2021 at 10:11AM +0100, Quentin Perret wrote: > On Thursday 22 Jul 2021 at 06:45:14 (+0000), Shameerali Kolothum Thodi wrote: > > > From: Will Deacon [mailto:will@kernel.org] > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > b/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > index 4b60c0056c04..a02c4877a055 100644 > > > > --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > @@ -106,8 +106,7 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool, > > > void *dev_pgt_pool) > > > > mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd); > > > > mmu->arch = &host_kvm.arch; > > > > mmu->pgt = &host_kvm.pgt; > > > > - mmu->vmid.vmid_gen = 0; > > > > - mmu->vmid.vmid = 0; > > > > + atomic64_set(&mmu->vmid.id, 0); > > > > > > I think this is the first atomic64 use in the EL2 object, which may pull in > > > some fatal KCSAN instrumentation. Quentin, have you run into this before? > > > > > > Might be simple just to zero-initialise mmu for now, if it isn't already. > > > > I will check that. > > Yes I think what saves us here is that, AFAICT. arm64 doesn't support > KCSAN yet. But the day it does, this should fail to link (hopefully) > because of out-of-line calls into e.g. __kasan_check_write(). > > So yes, a simple zeroing here is probably preferable. Note: Do not worry about hypothetically breaking with sanitizers here -- whether it's KASAN or KCSAN, they both instrument atomics. In files that enable instrumentation but the atomic instrumentation should not be pulled in, use the arch_ variants, but this doesn't apply here because instrumentation shouldn't even be on. The indicator that when KCSAN is supported on arm64, the Makefile here just needs KCSAN_SANITIZE := n, is that all other instrumentation is also killed entirely: $ grep -E "(PROFILE|SANITIZE|INSTRUMENT)" arch/arm64/kvm/hyp/nvhe/Makefile GCOV_PROFILE := n KASAN_SANITIZE := n UBSAN_SANITIZE := n KCOV_INSTRUMENT := n KCSAN isn't supported on arm64 yet, and when it does, I believe Mark's arm64 KCSAN series should take care of things like this. Thanks, -- Marco From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.0 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 92A97C4338F for ; Fri, 23 Jul 2021 08:08:04 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 047EF60F02 for ; Fri, 23 Jul 2021 08:08:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 047EF60F02 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 616444B16A; Fri, 23 Jul 2021 04:08:03 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TvzXuP6lTX4v; Fri, 23 Jul 2021 04:08:02 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 56DBD4B126; Fri, 23 Jul 2021 04:08:02 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7B2134A523 for ; Thu, 22 Jul 2021 15:34:02 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uTGd-XowUj8j for ; Thu, 22 Jul 2021 15:34:01 -0400 (EDT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 63A3240808 for ; Thu, 22 Jul 2021 15:34:01 -0400 (EDT) Received: by mail-wm1-f42.google.com with SMTP id o5-20020a1c4d050000b02901fc3a62af78so2190636wmh.3 for ; Thu, 22 Jul 2021 12:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jhYsOx1LWs0cX/jFmHSeQJdM5hC2M39ceQWiy7371d4=; b=KTUsRkXf4ffoeh8ZbMqm31lud2SqLwVvOFo7Cl2jnZ4J7pYL55bBrPIbwLHe7pbaIo QmdCWIukoUmVQDGqMENWtc6ektd6uNOD0Zx6uv2T51mssBNN+QkOjO2Kf02iUMGrSdFP rvHBMP34dGJ4DxuBpgwrmtNKsX0N6bwKa8S1iKjblT/SMsr/37cPbcPC5Qq4d2kyughj NRfdclkQgGSeOoeH2m4zQvPUyHu5Ljw7VTnHtEDlEu1QZCJVkS6wsAYhqdUjNad07ELy SvHcE1/bVW4/ZNw9ppykjxm++rFPjlt4PDvgUvZj5IpOG2vzz13X2TOIiU7OhY6ONeY1 Cvmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jhYsOx1LWs0cX/jFmHSeQJdM5hC2M39ceQWiy7371d4=; b=eXt7diJxM2rGcsHkg4ZZndc13UxTDY6B5tYsTmnqko25ENTi18M3UvCTJpNUloN6Mo +uGCP0hgX5gemhJX2qQQewbKSa1hFpRXrHDYNLwIXH50ScjUazztztuwci+a21jMj8qv DCSu6IV2dwu+sKM6XdzXOzMcI6409UrXrFmsV1B61Ef+c90zdzhljsZZrHEls7r62ONO 3evrYuaGcQkisxePEIVSv3NT9ks7dnDP5oSHqQcED+tFJxHa3yukqPThlUa81Luh4UaC GqRi6jWOGC6uS4REiKhNGiZgsUy9kjVU2ptA1ryZhj7bDGOANfmLGMH/51QRYrOROQ/u 7l0w== X-Gm-Message-State: AOAM532ifAvdwnE+9tUNPGzLES/6FxuWhcuKyx9eMDUzMh++SyFgMQ14 rWIOvoosE4ZJYbPW/n4xVID0bw== X-Google-Smtp-Source: ABdhPJzAV0SGTymmduCOhJtF1fux4J5JcXs5+NUVNCIiqHcjF/y0IV5ZQ7B4UnjMDgV+7PIFPHmd6A== X-Received: by 2002:a7b:c351:: with SMTP id l17mr1121772wmj.120.1626982440145; Thu, 22 Jul 2021 12:34:00 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:15:13:f1d2:f5fd:de90:c735]) by smtp.gmail.com with ESMTPSA id t6sm31102302wru.75.2021.07.22.12.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 12:33:59 -0700 (PDT) Date: Thu, 22 Jul 2021 21:33:52 +0200 From: Marco Elver To: Quentin Perret Subject: Re: [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one Message-ID: References: <20210616155606.2806-1-shameerali.kolothum.thodi@huawei.com> <20210616155606.2806-4-shameerali.kolothum.thodi@huawei.com> <20210721163138.GD11003@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) X-Mailman-Approved-At: Fri, 23 Jul 2021 04:08:00 -0400 Cc: "jean-philippe@linaro.org" , "maz@kernel.org" , "linux-kernel@vger.kernel.org" , Linuxarm , "catalin.marinas@arm.com" , Will Deacon , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Thu, Jul 22, 2021 at 10:11AM +0100, Quentin Perret wrote: > On Thursday 22 Jul 2021 at 06:45:14 (+0000), Shameerali Kolothum Thodi wrote: > > > From: Will Deacon [mailto:will@kernel.org] > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > b/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > index 4b60c0056c04..a02c4877a055 100644 > > > > --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > @@ -106,8 +106,7 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool, > > > void *dev_pgt_pool) > > > > mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd); > > > > mmu->arch = &host_kvm.arch; > > > > mmu->pgt = &host_kvm.pgt; > > > > - mmu->vmid.vmid_gen = 0; > > > > - mmu->vmid.vmid = 0; > > > > + atomic64_set(&mmu->vmid.id, 0); > > > > > > I think this is the first atomic64 use in the EL2 object, which may pull in > > > some fatal KCSAN instrumentation. Quentin, have you run into this before? > > > > > > Might be simple just to zero-initialise mmu for now, if it isn't already. > > > > I will check that. > > Yes I think what saves us here is that, AFAICT. arm64 doesn't support > KCSAN yet. But the day it does, this should fail to link (hopefully) > because of out-of-line calls into e.g. __kasan_check_write(). > > So yes, a simple zeroing here is probably preferable. Note: Do not worry about hypothetically breaking with sanitizers here -- whether it's KASAN or KCSAN, they both instrument atomics. In files that enable instrumentation but the atomic instrumentation should not be pulled in, use the arch_ variants, but this doesn't apply here because instrumentation shouldn't even be on. The indicator that when KCSAN is supported on arm64, the Makefile here just needs KCSAN_SANITIZE := n, is that all other instrumentation is also killed entirely: $ grep -E "(PROFILE|SANITIZE|INSTRUMENT)" arch/arm64/kvm/hyp/nvhe/Makefile GCOV_PROFILE := n KASAN_SANITIZE := n UBSAN_SANITIZE := n KCOV_INSTRUMENT := n KCSAN isn't supported on arm64 yet, and when it does, I believe Mark's arm64 KCSAN series should take care of things like this. Thanks, -- Marco _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 27648C4338F for ; Thu, 22 Jul 2021 19:35:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E5DAF60EB2 for ; Thu, 22 Jul 2021 19:35:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E5DAF60EB2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dMjzBuHWlNd80kmMSXNPcZiSxNaCdxvZA3mQuyVjyUQ=; b=EyZSa/VNbHsYZN HwFCbRBJnBfLCOqWJ6uomrNh0ciqAObaI7TupwcoSVMC32GN8K3XK6p0o603do/Yeja5yrwBtv3yE KNJkjg/VI8k4trTh6Dyzv9alw8gy4ATTJQzNLq3McKiDMWqG7/6aLDQnmh2ifn7EgGBs+CLo5k6mf y8t6SLEAH3vv1VRTGqFCaw9VdIl3xXhMj3VsJrdh0fsZuW35q1wpQOenlJuyu5wUFjL6UaNxFWtqK 042My6bCYXudszNyKp0dk89I9+5OFoJextxdO86R/TX4HMkd04OI+okurN7XxyChS1QQelqkmrzun Zgqr2tAmFa3jJI+BA9SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6eSM-002ZfW-3d; Thu, 22 Jul 2021 19:34:06 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6eSH-002Zew-Ig for linux-arm-kernel@lists.infradead.org; Thu, 22 Jul 2021 19:34:02 +0000 Received: by mail-wm1-x32b.google.com with SMTP id x14-20020a7bc20e0000b0290249f2904453so3070246wmi.1 for ; Thu, 22 Jul 2021 12:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jhYsOx1LWs0cX/jFmHSeQJdM5hC2M39ceQWiy7371d4=; b=KTUsRkXf4ffoeh8ZbMqm31lud2SqLwVvOFo7Cl2jnZ4J7pYL55bBrPIbwLHe7pbaIo QmdCWIukoUmVQDGqMENWtc6ektd6uNOD0Zx6uv2T51mssBNN+QkOjO2Kf02iUMGrSdFP rvHBMP34dGJ4DxuBpgwrmtNKsX0N6bwKa8S1iKjblT/SMsr/37cPbcPC5Qq4d2kyughj NRfdclkQgGSeOoeH2m4zQvPUyHu5Ljw7VTnHtEDlEu1QZCJVkS6wsAYhqdUjNad07ELy SvHcE1/bVW4/ZNw9ppykjxm++rFPjlt4PDvgUvZj5IpOG2vzz13X2TOIiU7OhY6ONeY1 Cvmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jhYsOx1LWs0cX/jFmHSeQJdM5hC2M39ceQWiy7371d4=; b=Gp08s+I3slxDiQc+tnduTNlF2Pa5BW0v/p1kSm1BbGYu7LPoGKyjnbKzVV8jtUzYRP P/4on81T61W7f/kN1ep8WQoKu1hzCFNTGlNDlIMo+2dQ8OOrMop5si7mSzi6w7irIGXn hMxc0K7CY7gUvkotevdn7Mlm/OlPGPCIdzadngjjC263iKApdP6Kb94W5BZ1EpqkQ01b Mj0Ca3I6Ok4vz2+D7oVpvSIr2OHOEtyUzfgZQrM3A/mzJLgV8YuYvnRxC4ELCu6DTb2o OOktWzYO+F6s3RXE1myf6VnsBTi3xX5UivcmrbLe4JTTBhXHoT3+2ZT3peh3vKpx/FpR 0GvA== X-Gm-Message-State: AOAM531c6dQcz33zFWJ8zmGCadUQAN3AUfCY3z8YjV1l8i7hzEP8ghXu BHxjCbUzGPXbU2/ZfC9UE0wELA== X-Google-Smtp-Source: ABdhPJzAV0SGTymmduCOhJtF1fux4J5JcXs5+NUVNCIiqHcjF/y0IV5ZQ7B4UnjMDgV+7PIFPHmd6A== X-Received: by 2002:a7b:c351:: with SMTP id l17mr1121772wmj.120.1626982440145; Thu, 22 Jul 2021 12:34:00 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:15:13:f1d2:f5fd:de90:c735]) by smtp.gmail.com with ESMTPSA id t6sm31102302wru.75.2021.07.22.12.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 12:33:59 -0700 (PDT) Date: Thu, 22 Jul 2021 21:33:52 +0200 From: Marco Elver To: Quentin Perret Cc: Shameerali Kolothum Thodi , Will Deacon , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "linux-kernel@vger.kernel.org" , "maz@kernel.org" , "catalin.marinas@arm.com" , "james.morse@arm.com" , "julien.thierry.kdev@gmail.com" , "suzuki.poulose@arm.com" , "jean-philippe@linaro.org" , "Alexandru.Elisei@arm.com" , Linuxarm , mark.rutland@arm.com Subject: Re: [PATCH v2 3/3] kvm/arm: Align the VMID allocation with the arm64 ASID one Message-ID: References: <20210616155606.2806-1-shameerali.kolothum.thodi@huawei.com> <20210616155606.2806-4-shameerali.kolothum.thodi@huawei.com> <20210721163138.GD11003@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210722_123401_676514_91D3D69A X-CRM114-Status: GOOD ( 22.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 22, 2021 at 10:11AM +0100, Quentin Perret wrote: > On Thursday 22 Jul 2021 at 06:45:14 (+0000), Shameerali Kolothum Thodi wrote: > > > From: Will Deacon [mailto:will@kernel.org] > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > b/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > index 4b60c0056c04..a02c4877a055 100644 > > > > --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c > > > > @@ -106,8 +106,7 @@ int kvm_host_prepare_stage2(void *mem_pgt_pool, > > > void *dev_pgt_pool) > > > > mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd); > > > > mmu->arch = &host_kvm.arch; > > > > mmu->pgt = &host_kvm.pgt; > > > > - mmu->vmid.vmid_gen = 0; > > > > - mmu->vmid.vmid = 0; > > > > + atomic64_set(&mmu->vmid.id, 0); > > > > > > I think this is the first atomic64 use in the EL2 object, which may pull in > > > some fatal KCSAN instrumentation. Quentin, have you run into this before? > > > > > > Might be simple just to zero-initialise mmu for now, if it isn't already. > > > > I will check that. > > Yes I think what saves us here is that, AFAICT. arm64 doesn't support > KCSAN yet. But the day it does, this should fail to link (hopefully) > because of out-of-line calls into e.g. __kasan_check_write(). > > So yes, a simple zeroing here is probably preferable. Note: Do not worry about hypothetically breaking with sanitizers here -- whether it's KASAN or KCSAN, they both instrument atomics. In files that enable instrumentation but the atomic instrumentation should not be pulled in, use the arch_ variants, but this doesn't apply here because instrumentation shouldn't even be on. The indicator that when KCSAN is supported on arm64, the Makefile here just needs KCSAN_SANITIZE := n, is that all other instrumentation is also killed entirely: $ grep -E "(PROFILE|SANITIZE|INSTRUMENT)" arch/arm64/kvm/hyp/nvhe/Makefile GCOV_PROFILE := n KASAN_SANITIZE := n UBSAN_SANITIZE := n KCOV_INSTRUMENT := n KCSAN isn't supported on arm64 yet, and when it does, I believe Mark's arm64 KCSAN series should take care of things like this. Thanks, -- Marco _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel