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=-9.4 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 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 7FC41C07E96 for ; Sun, 11 Jul 2021 17:00:57 +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 3C1AB610A6 for ; Sun, 11 Jul 2021 17:00:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C1AB610A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VXXNv2BeJ3s6tH0WWZ3D6tCxiLhM4dQ6iooQNBR9UAk=; b=GOgWBAkcefCINi ObHxV/Iyt6HQsMQz4Yp5sbqc/nq7hk4gGapahe1+4VQG88FvmVgtY9p+CkjzpWi+bYtvgL2crJCvP /w5I0sYYZRscz18G8Cn1zJYHPvRh4cLG1P6GoqtAK8h+q2jDUY9/OF8+Wb5IfscPNzOprbT7dqdYs le5rmxrBtP+GlNUbYDSgamFAkrZYdwxTP8gCIK+jvTAmI7tev3BlWRECevvkfLwRWwo3xzMAZxVfc OqfJizOUIhhm3RzimVa3nUfYqbUT+HKsZrqZLgkOgXquzGmfU/R4mnX126g6S7uAfA9Wfb3kxOv/B w7V0ylM94rm8GTqWNqsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2cnK-005Ihc-Vd; Sun, 11 Jul 2021 16:59:07 +0000 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2cnH-005Ih4-ER for linux-arm-kernel@lists.infradead.org; Sun, 11 Jul 2021 16:59:04 +0000 Received: by mail-qk1-x72e.google.com with SMTP id 77so13635443qkk.11 for ; Sun, 11 Jul 2021 09:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WBrOScKV3V16Gyn7bGSSQx+6TsqpJhHYRyGGGXA76Gw=; b=XDFA9W2l1rFNr7zIb0SxhYtrGZi0uF2umXU/lKQCUzrolek4SiNuvCz8QlhhppcOQA x9j0221CuPLl2I0O4BiflTtMbarRMobfBt+5l2bTLfAfG+Ywex5sQuHCJqTdIoXfnLoO CHpgwOGgkdaZqWTMoJfSA9JjfVYRw6Xv22o6kRJ/MjYm6deqSp6TRD0WgS9DuwyBtTCb fuigYcMH87jTxs5XBY56KByk8PnjJO/AhHvfcTRG1NM7cyWfFJL5XM1MjlHcD0q49cP6 4w6Mj+4CiFZz1JEaBhJ35SSJ7LDplkfgDIoi2YzFvUEgxxmBz8NTIoLy+LrOLPnMlWhO IQUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WBrOScKV3V16Gyn7bGSSQx+6TsqpJhHYRyGGGXA76Gw=; b=LItVTPmvg6k9mTssjMFCCX9OeUf/w6/nMKNai/3oIim1bnViecKAGoDlAyrrPvoHKC /mrQ1uVXC49XUufzcTs0loPuIWmumcSxFgPcgs/zm6dv3tA/JHvtMno504fk2pF4Qb1Z e3OYeOHob7VwwMXPxwf/gF7y/dOSUPv6VwDg/2JB6y3t2OrCewc+PgBcEXMPpagFuMLX RZny5yYgg/xTvJSvBXqjnyy9vmO2dPcS2HdVyJ1beyVT/Ews+HZqZRC0UKG1pJZBPxzf FDYKXzmsn7KQfo9J32iC8c/gSkT2fyhcx06vvRA30fwrrKHoekPq4bFCTBUTQ5i35rLW bWAA== X-Gm-Message-State: AOAM53276dRL9t2vTLzcRazQ4vZgH9c9SNrXLCm+3Ew3JnGRsp7yeJib 6UUK8ufiVd24/8GYKIjJXVtUf8o2reKeBdsO/pniOQ== X-Google-Smtp-Source: ABdhPJxXCOIObgL8OrlRPXQtRuJlWZZ+YUWJD9kYGloo0i/JQjCzHExS9EJkLyVI5sIdVJoID4+63EbWKLVtdPFxhl8= X-Received: by 2002:ae9:dd43:: with SMTP id r64mr47648567qkf.216.1626022738963; Sun, 11 Jul 2021 09:58:58 -0700 (PDT) MIME-Version: 1.0 References: <20210709043713.887098-1-senozhatsky@chromium.org> <20210709043713.887098-3-senozhatsky@chromium.org> In-Reply-To: From: Joel Fernandes Date: Sun, 11 Jul 2021 12:58:47 -0400 Message-ID: Subject: Re: [PATCHv2 2/4] arm64: add guest pvstate support To: Sergey Senozhatsky Cc: Marc Zyngier , Will Deacon , Suleiman Souhlal , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210711_095903_548853_8F1EAC07 X-CRM114-Status: GOOD ( 19.56 ) 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 Fri, Jul 9, 2021 at 5:53 PM Sergey Senozhatsky wrote: > > > +DECLARE_STATIC_CALL(pv_vcpu_is_preempted, dummy_vcpu_is_preempted); > > > + > > > +static inline bool paravirt_vcpu_is_preempted(unsigned int cpu) > > > +{ > > > + return static_call(pv_vcpu_is_preempted)(cpu); > > > +} > > > + > > > +int __init pv_vcpu_state_init(void); > > > + > > > #else > > > > > > +#define pv_vcpu_state_init() do {} while (0) > > > + > > > #define pv_time_init() do {} while (0) > > > > > > #endif // CONFIG_PARAVIRT > > > diff --git a/arch/arm64/kernel/paravirt.c b/arch/arm64/kernel/paravirt.c > > > index 75fed4460407..d8fc46795d94 100644 > > > --- a/arch/arm64/kernel/paravirt.c > > > +++ b/arch/arm64/kernel/paravirt.c > > > @@ -40,6 +40,11 @@ struct pv_time_stolen_time_region { > > > > > > static DEFINE_PER_CPU(struct pv_time_stolen_time_region, stolen_time_region); > > > > > > +static DEFINE_PER_CPU(struct vcpu_state, vcpus_states); > > > +struct static_key pv_vcpu_is_preempted_enabled; > > > + > > > +DEFINE_STATIC_CALL(pv_vcpu_is_preempted, dummy_vcpu_is_preempted); > > > > Could we use DEFINE_STATIC_CALL_NULL and get rid of the dummy > > function? I believe that makes the function trampoline as return > > instruction, till it is updated. > > Is DEFINE_STATIC_CALL_NULL for cases when function returns void? > > We need something that returns `false` to vcpu_is_preempted() or > per_cpu(vcpus_states) once pv vcpu-state is initialised. Ah, that might be problematic. In which case what you did is fine. Thanks, - Joel > > [..] > > > +static bool __vcpu_is_preempted(unsigned int cpu) > > > +{ > > > + struct vcpu_state *st; > > > + > > > + st = &per_cpu(vcpus_states, cpu); > > > + return READ_ONCE(st->preempted); > > > > I guess you could just do: > > { > > return READ_ONCE(per_cpu(vcpus_states, cpu).preempted); > > } > > Ack. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel