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=-6.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 A6364C433E0 for ; Thu, 21 May 2020 10:13:31 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 6E7DE2072C for ; Thu, 21 May 2020 10:13:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TgVmMm0s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E7DE2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jbiCD-00006M-BX; Thu, 21 May 2020 10:13:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jbiCC-00006H-Js for xen-devel@lists.xenproject.org; Thu, 21 May 2020 10:13:00 +0000 X-Inumbo-ID: a591a190-9b4b-11ea-b07b-bc764e2007e4 Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a591a190-9b4b-11ea-b07b-bc764e2007e4; Thu, 21 May 2020 10:12:59 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id g9so6284396edw.10 for ; Thu, 21 May 2020 03:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=xTOAQMdFJ8ZQa7G8tNEiJrlhqwWuXNce7Xeryge4dCY=; b=TgVmMm0sZduOIJ27pb2jz92xZDTCtvZyEQNTPqkYWpXCAtWnVZzDyAcf5vYT1scEXJ 1lz7D/JAPAvqi7i1bd+k/+Q1+Aaz5q+NQplbqfGYIw3zoqP5VDSSMRkyAgebB4UbnvXn ggezOJc8/FB7psmg87hNSMu8lvHWkm6yCxKZGdjqG8kcKPozdT9UAlZc6+KRfFqaf9hE gqS84orfky+gwH+F2N6ZUXpmSs8gJtWJvmuZUR/GlmpVE1Y3doCqSd7ScYqt5dF4yGVG pMySmgzykp6EW9vY3sBISM/XObVSAcliqV2T/JYQU4Aq9INhMSrw0ezko8wFlL+z0qFR 961g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :content-language:thread-index; bh=xTOAQMdFJ8ZQa7G8tNEiJrlhqwWuXNce7Xeryge4dCY=; b=X5nbchDwMiyh9dBMn5i7j31IZRoYleUVFZjtNmIn9cBvroCmJe8GnIlCrYvN1w7695 Y+w3/feos8aMG41HVA4QqNE0dLEwz00v+mAvQMH5wprHhfcVZEPCRjjDIicEA8+EUvvt 1+zzU1IBgQjAx/Rf3v00kYxVTcmUmBHVx0XT/Jpm2a+chyGKS1SKlT7xfN+WEaWR5BP/ bXu/UqcZAimkh8g8otTU9B7DsMz9lBX1q0SCf+josEOshmRqPuBJRxXORlT6J5pREHi7 r97tElUp7j8G1KcmH/SXRhOj4nnjIUo5Q51aTrUyoCeNXmDXDzZZh+ctJNNywrEPgkTd ojnQ== X-Gm-Message-State: AOAM530/9yjpnq6GrlL8aVHk42TqYLIGroCyQDj7vflR0ot02zPo6eRf fSD/hSdmTSLV4d8vKiClBPg= X-Google-Smtp-Source: ABdhPJybgDobutCpQyXSEUrAQNSmHWCs161JKh8wLT47yfnEVBYIilZ7dWrA7pqBD/v17gIeYEY6yg== X-Received: by 2002:a05:6402:348:: with SMTP id r8mr7025133edw.130.1590055978659; Thu, 21 May 2020 03:12:58 -0700 (PDT) Received: from CBGR90WXYV0 ([54.239.6.187]) by smtp.gmail.com with ESMTPSA id v3sm4644534edd.16.2020.05.21.03.12.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2020 03:12:58 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" To: "'Andrew Cooper'" , "'Xen-devel'" References: <20200521090428.11425-1-andrew.cooper3@citrix.com> In-Reply-To: <20200521090428.11425-1-andrew.cooper3@citrix.com> Subject: RE: [PATCH] x86/shadow: Reposition sh_remove_write_access_from_sl1p() Date: Thu, 21 May 2020 11:12:56 +0100 Message-ID: <003e01d62f58$66bbcea0$34336be0$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQDdpNCtQ9xLcYIXGO2ueKFGd4o5OqqjZl1A X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Reply-To: paul@xen.org Cc: 'Tim Deegan' , 'Jan Beulich' , 'Wei Liu' , =?utf-8?Q?'Roger_Pau_Monn=C3=A9'?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----Original Message----- > From: Xen-devel On Behalf Of = Andrew Cooper > Sent: 21 May 2020 10:04 > To: Xen-devel > Cc: Andrew Cooper ; Tim Deegan = ; Wei Liu ; Jan > Beulich ; Roger Pau Monn=C3=A9 = > Subject: [PATCH] x86/shadow: Reposition = sh_remove_write_access_from_sl1p() >=20 > When compiling with SHOPT_OUT_OF_SYNC disabled, the build fails with: >=20 > common.c:41:12: error: = =E2=80=98sh_remove_write_access_from_sl1p=E2=80=99 declared = =E2=80=98static=E2=80=99 but never defined [- > Werror=3Dunused-function] > static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t = gmfn, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > due to an unguarded forward declaration. Is this, perhaps, an argument for making SHADOW_OPTIMIZATIONS tunable = via Kconfig so that randconfig could catch things like this? Paul >=20 > It turns out there is no need to forward declare > sh_remove_write_access_from_sl1p() to begin with, so move it to just = ahead of > its first users, which is within a larger #ifdef'd SHOPT_OUT_OF_SYNC = block. >=20 > Fix up for style while moving it. No functional change. >=20 > Signed-off-by: Andrew Cooper > --- > CC: Jan Beulich > CC: Wei Liu > CC: Roger Pau Monn=C3=A9 > CC: Tim Deegan > --- > xen/arch/x86/mm/shadow/common.c | 56 = ++++++++++++++++++----------------------- > 1 file changed, 25 insertions(+), 31 deletions(-) >=20 > diff --git a/xen/arch/x86/mm/shadow/common.c = b/xen/arch/x86/mm/shadow/common.c > index 0ac3f880e1..6dff240e97 100644 > --- a/xen/arch/x86/mm/shadow/common.c > +++ b/xen/arch/x86/mm/shadow/common.c > @@ -38,9 +38,6 @@ > #include > #include "private.h" >=20 > -static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t = gmfn, > - mfn_t smfn, unsigned long = offset); > - > DEFINE_PER_CPU(uint32_t,trace_shadow_path_flags); >=20 > static int sh_enable_log_dirty(struct domain *, bool log_global); > @@ -252,6 +249,31 @@ static inline void _sh_resync_l1(struct vcpu *v, = mfn_t gmfn, mfn_t snpmfn) > SHADOW_INTERNAL_NAME(sh_resync_l1, 4)(v, gmfn, snpmfn); > } >=20 > +static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t = gmfn, > + mfn_t smfn, unsigned long = off) > +{ > + struct page_info *sp =3D mfn_to_page(smfn); > + > + ASSERT(mfn_valid(smfn)); > + ASSERT(mfn_valid(gmfn)); > + > + if ( sp->u.sh.type =3D=3D SH_type_l1_32_shadow || > + sp->u.sh.type =3D=3D SH_type_fl1_32_shadow ) > + return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 2) > + (d, gmfn, smfn, off); > + > + if ( sp->u.sh.type =3D=3D SH_type_l1_pae_shadow || > + sp->u.sh.type =3D=3D SH_type_fl1_pae_shadow ) > + return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 3) > + (d, gmfn, smfn, off); > + > + if ( sp->u.sh.type =3D=3D SH_type_l1_64_shadow || > + sp->u.sh.type =3D=3D SH_type_fl1_64_shadow ) > + return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 4) > + (d, gmfn, smfn, off); > + > + return 0; > +} >=20 > /* > * Fixup arrays: We limit the maximum number of writable mappings to > @@ -2001,34 +2023,6 @@ int sh_remove_write_access(struct domain *d, = mfn_t gmfn, > } > #endif /* CONFIG_HVM */ >=20 > -#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) > -static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t = gmfn, > - mfn_t smfn, unsigned long = off) > -{ > - struct page_info *sp =3D mfn_to_page(smfn); > - > - ASSERT(mfn_valid(smfn)); > - ASSERT(mfn_valid(gmfn)); > - > - if ( sp->u.sh.type =3D=3D SH_type_l1_32_shadow > - || sp->u.sh.type =3D=3D SH_type_fl1_32_shadow ) > - { > - return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p,2) > - (d, gmfn, smfn, off); > - } > - else if ( sp->u.sh.type =3D=3D SH_type_l1_pae_shadow > - || sp->u.sh.type =3D=3D SH_type_fl1_pae_shadow ) > - return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p,3) > - (d, gmfn, smfn, off); > - else if ( sp->u.sh.type =3D=3D SH_type_l1_64_shadow > - || sp->u.sh.type =3D=3D SH_type_fl1_64_shadow ) > - return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p,4) > - (d, gmfn, smfn, off); > - > - return 0; > -} > -#endif > - > = /************************************************************************= **/ > /* Remove all mappings of a guest frame from the shadow tables. > * Returns non-zero if we need to flush TLBs. */ > -- > 2.11.0 >=20