Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp244045pxk; Thu, 17 Sep 2020 01:38:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjDCK3Kzi49DQQG/SZqpSz0bw3mueziiyw9iUeJ9mcstB2rkw91olWMPnjfp2dfxSTJbH/ X-Received: by 2002:a17:906:af6a:: with SMTP id os10mr28942729ejb.34.1600331888072; Thu, 17 Sep 2020 01:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600331888; cv=none; d=google.com; s=arc-20160816; b=PNbGb8uW/BzZIuncGHUYErdbAqAAT0YBsaYaB0FgUUNTOn96KDjYLLk0Jyj3ehMOlh qh3Q/jcj62VB3M02sq872QiirQIXiwaZ/gRlYFx8iRthiSzY5bqBwFSFTsQv6ZJW3xmw GlRvMHeSTHn0YQvRpQk+H/eTd676qxYK9mfgnIb1w08vQ1fpwKXdBx9EqDOGKgT5dDjB HrCSaJtEZCFAdwcYM+6pIJwRx2oiVGFOVqDUX7KTjvQ2jYpPB4B3u8MdzJChBD7+8LxG 5mfAFS6B8OuM9hy3b4+UessMCL2JF2M9ExfY2/LSGXhOdK3vX7REXUNDc2JWz3fkguuW HTfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Pk1ggKwYhiZFij3cWsXPx/AsObXSSswRVDTN18QPE2I=; b=e/KMWuHWlpzxeb1rYFrcRXjHpozHLC/7R+geO4Rga9k+tNZMsg6E1RAgpqV9ys0AIM I0/ThrO+SX7kSoEqAqW0MbdfDqszTPTDmgCpf3nfTEBUAAj3lj46JbA9Th/4/AFRm2u8 wW8y1AOOlaLgtqZG0d/u04s72xM0xSciayi/XOO/wE6FLRoTQEOBq0ApLbm1H6+Dapvf YHmtWiZoc27JCSLjZo63dSmYSwFwRmMYcNTwLXTM/eo9KJZ+zQzV6jZFkF2rUWNzobEr DUlkQfQ1M44yvVRLBCCyzgIrZqPWQ7CW6upDOpcX4ssOHmE00c1qssqQZqBrJPrrBZ8G M5nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OqIh71Za; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si13088609ejw.357.2020.09.17.01.37.44; Thu, 17 Sep 2020 01:38:08 -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=@google.com header.s=20161025 header.b=OqIh71Za; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726381AbgIQIej (ORCPT + 99 others); Thu, 17 Sep 2020 04:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbgIQIee (ORCPT ); Thu, 17 Sep 2020 04:34:34 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6A53C061756 for ; Thu, 17 Sep 2020 01:34:33 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id s12so1069915wrw.11 for ; Thu, 17 Sep 2020 01:34:33 -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; bh=Pk1ggKwYhiZFij3cWsXPx/AsObXSSswRVDTN18QPE2I=; b=OqIh71Za/Sfud+/Ld2OIcnclZx0GScK1SioXnMYhhN+wJMXNO+nPqZVsSowByH13lC IA6VorWMqWg30MkyELqC6xs0OUIYHEpQ1N2DayLyrSn6ouvhsIfCAuKYtjiTW+wd3ouU jb3YvRKbbD2HnPJAhGCH53RJMDZ6i/Jg/pj2l3dAbI5yyfqfzyqgHU8awtuhdEs/sEHb J5gH3ixTa90rSdfYZcFrvEw9cFofCjgTDONXYlmxjKFrqpT2OyF+JPKkg7+0luusumjR ZI8i1Pjyu6ykougSn/5jMLvYtGPzAD6CVr/1WKJDk5qo6HFoWi/zZ+Ua9z+YFBgCzakv 8CUg== 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; bh=Pk1ggKwYhiZFij3cWsXPx/AsObXSSswRVDTN18QPE2I=; b=dz23qouAltXizChJ9gpSr/looDdgNndxu8+VDhy0o2ALeqqkDOtpVfvezu346Kc1Dq N84BGSdadFICjDfgWsm1Nq7Tu+y7Zz0zQaYIxUxTIycwTLi3inKw490zRuLI6OiI8cAJ MWo0fAVWXMmExJLBYADcQ1rQdk6ZVsKjnKCBTbxIbzWOVRtn15u0rqtxQ8qrQK20hSsB SG6GLn5yR0FUojvgSR4P+yzzJ6xgp8ZZc067knbs5+3Z23oCSFsNQzx/9KVyUhGmMbpx o02mxdItJEPmzxudFijvD2Sg6s3gn35lgEymtLZHfDPor4gPu16xzLMhIPH5P6ycNZVB b+7g== X-Gm-Message-State: AOAM5328zVMr+nKj53Fddao6NKuNRVxIRuT6hMjZ6gHfWjYZ63QvHERQ NNsMyuIo+0fjK6nMXnwTTUM6aQ== X-Received: by 2002:a5d:4645:: with SMTP id j5mr30654727wrs.230.1600331672159; Thu, 17 Sep 2020 01:34:32 -0700 (PDT) Received: from google.com ([2a01:4b00:8523:2d03:1155:1c40:3244:2fc2]) by smtp.gmail.com with ESMTPSA id s17sm39708604wrr.40.2020.09.17.01.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 01:34:31 -0700 (PDT) Date: Thu, 17 Sep 2020 09:34:30 +0100 From: David Brazdil To: Andrew Scull Cc: Marc Zyngier , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Arnd Bergmann , James Morse , Julien Thierry , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 03/10] kvm: arm64: Remove __hyp_this_cpu_read Message-ID: <20200917083430.sxe4rpwp2lrdu3hq@google.com> References: <20200903091712.46456-1-dbrazdil@google.com> <20200903091712.46456-4-dbrazdil@google.com> <20200910111225.GC93664@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910111225.GC93664@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Andrew, > > +#ifdef __KVM_NVHE_HYPERVISOR__ > > +#define __my_cpu_offset __hyp_my_cpu_offset() > > Is there a benefit to this being used for __KVM_VHE_HYPERVISOR__ too > since that is "hyp" too and doesn't need the alternative since it will > always pick EL2? Minor time and space savings, but you're right, makes sense to treat them equally. Updated in v3. > > +/* Redefine macros for nVHE hyp under DEBUG_PREEMPT to avoid its dependencies. */ > > +#if defined(__KVM_NVHE_HYPERVISOR__) && defined(CONFIG_DEBUG_PREEMPT) > > +#undef this_cpu_ptr > > +#define this_cpu_ptr raw_cpu_ptr > > +#undef __this_cpu_read > > +#define __this_cpu_read raw_cpu_read > > +#undef __this_cpu_write > > +#define __this_cpu_write raw_cpu_write > > +#endif > > This is an incomplete cherry-picked list of macros that are redefined to > remove the call to __this_cpu_preempt_check that would result in a > linker failure since that symbol is not defined for nVHE hyp. > > I remember there being some dislike of truely defining that symbol with > an nVHE hyp implementation but I can't see why. Yes, nVHE hyp is always > has preemption disabled so the implementation is just an empty function > but why is is preferrable to redefine some of these macros instead? That was my initial implementation and we could probably sway others in that direction, too. That said, I just tried it on 5.9-rc5 and there are two more dependencies. No idea what changed sinced the last time I tried, maybe I simply messed up back then. Basically, this_cpu_ptr translates to: __this_cpu_preempt_check(); per_cpu_ptr(sym, debug_smp_processor_id()) __this_cpu_preempt_check: should be empty for hyp per_cpu_ptr: needs mapping of the array of bases in hyp, otherwise easy debug_smp_processor_id: needs a clone of 'cpu_number' percpu variable Neither of these is particularly difficult to implement, and two will even be useful going forward, but it still feels too fiddly for posting this late in the 5.10 cycle. So I suggest we stick to the macro redefines for now and I'll post those patches for 5.11. WDYT? You can find the patches on branch 'topic/percpu-v3-debug-preempt' of https://android-kvm.googlesource.com/linux. David