Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp674775imm; Thu, 31 May 2018 07:31:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKmDLwIdMJtXHUCxCJCBnu60bmvLIE8Eym/J4P9U9QUX8yihXz6tZnK4Yr1k6DbH+YiglsX X-Received: by 2002:a17:902:74c8:: with SMTP id f8-v6mr7338125plt.317.1527777067314; Thu, 31 May 2018 07:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527777067; cv=none; d=google.com; s=arc-20160816; b=yNhFk9rJqwInxWgRTr5/Cu21ao422X3j2XHKMDIiFIJ+N0aIe8GtN7xg9eDna26U24 TEFRBnO+PncByE5sa/4WgwVDTrDDuCZlQ/69mBW7zDfA1Y4NE0CmOO5hMl1WfV04DYRE AjqWWqpy3ynl2bY3XYyxsxMRXpUX21U7kPseVQLRveCRO/FBS2PEQUGkq76lC2WA9kdm 1uAzvuPMICKk7sIaaVqdgLYTm4VefnrkKikrtdKlxF6bI06B3y+CMdqdDggwCdlpjIdG ZeRGoYP3fz1arU0HEzc5++3DefVISL/bPHapA6myIRpXjYsfp3pPqeOZAcIuX3yzvrmH Vs2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=giXPb6Y/jlyQf5cy+3Obmw0e+i/e6fY57mSpuqApk5Q=; b=KYerF/oWcjidzGSy46VWXd3LAoYmVQWo25EjMDxb6y4uNSl1GlUSffszDhOOLgt16/ J6HGYfLp75XkuQM/RFfWy48B7zq02MOS3DhlaeKICc3tCL1uCT2/57lvA3G9BGmkslbu CTNSfnSUhoLqTEy9FiRLYs2rpelSX+2WwnrFGdQOTu5cvtk68a/Zl1SGMjnacle410ul q6KQ49jnNM78j9KOCapVnzu7nK0tcxBU/E56qXAb6rhgAuY2kC67oBhDsZXWGIKUS8hz oMhwN2zt+tQYBg8M5qtg2jucTVVbkUYGDsciI5gzyE+iBITSX8E7vDMxTCFSZC1lgfsc KJBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sDhetk4j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id f59-v6si38030940plb.106.2018.05.31.07.30.53; Thu, 31 May 2018 07:31:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sDhetk4j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1755434AbeEaO3R (ORCPT + 99 others); Thu, 31 May 2018 10:29:17 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:42987 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755299AbeEaO3N (ORCPT ); Thu, 31 May 2018 10:29:13 -0400 Received: by mail-lf0-f67.google.com with SMTP id v135-v6so10063442lfa.9; Thu, 31 May 2018 07:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=giXPb6Y/jlyQf5cy+3Obmw0e+i/e6fY57mSpuqApk5Q=; b=sDhetk4jWtNCghEJrvZKpF5ZVrGOe0nOKM66PhDtQT8MoptZxu+x7TjTuIMrCXQv4d dvDO1yEf5x//kIY7QBS256tj2N+kuLwGjCHw+WJ96GmyRC2yxLur3Er3ff22V5kL0sIJ cHPrIKmHuuAqWXO4UCV0rWEUEHQeM33mmryvE3bM3cn8VLEXS6cSSnZ0L4sbtrrR1y4V Vyy/nAMgFHKMvDwP/rDTJMFpFUAXxfXpOrkgpidog/u4Jf8IIv0ncQvY9Y/YsqjOmwvB Byg2+Ugc7zw4NNhrs0QM0l4ADINF9c+EaeKkAqjycl4DzZTmKe4fngeqw+6glaOvWzgG dGVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=giXPb6Y/jlyQf5cy+3Obmw0e+i/e6fY57mSpuqApk5Q=; b=TiMXkqhKdsOYtWtV8usDaKPPLkyVReI6WIuF0iaJNUpNWfWVaYvmgMzwC/ipKR8dyO plZAcHW+vNaabrRihf/YFZfDP7STae8YmfMjN0JHfkoAHN7d9F8Bqg417YteJFDa1/Pl bowzATnuxgfc0D4Nom4UlF7AHwlPpLG7MQfwnLTRfhsKw48EZYkdzuWDUZbrVdjxSDXu cOzNXQ5fxTzhtoNyhnSObZYkE2swwZ/CX/wVia4kwHL60XwU/Sl3rOk5hm9+IRp24bC6 gR8oHArAiGQUkDEClRBeqYwTSfkxZZQS/+Zwg0rTCXDTHg2c0Df7H4vCTe+wbSTMCMXM HCyA== X-Gm-Message-State: ALKqPwfk3DU2SChfSgth7+wQ4+H5kob/nR4cAqEAom7KEySGJcm2k6qA m8bXLRBLs740TcwgDSUhgoU= X-Received: by 2002:a19:16e1:: with SMTP id 94-v6mr4108714lfw.45.1527776952008; Thu, 31 May 2018 07:29:12 -0700 (PDT) Received: from [10.17.182.9] (ll-51.209.223.85.sovam.net.ua. [85.223.209.51]) by smtp.gmail.com with ESMTPSA id k12-v6sm1673052lje.94.2018.05.31.07.29.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 07:29:11 -0700 (PDT) Subject: Re: [PATCH 2/8] xen/balloon: Move common memory reservation routines to a module From: Oleksandr Andrushchenko To: Boris Ostrovsky , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, jgross@suse.com, konrad.wilk@oracle.com Cc: daniel.vetter@intel.com, dongwon.kim@intel.com, matthew.d.roper@intel.com, Oleksandr Andrushchenko References: <20180525153331.31188-1-andr2000@gmail.com> <20180525153331.31188-3-andr2000@gmail.com> <59ab73b0-967b-a82f-3b0d-95f1b0dc40a5@oracle.com> <89de7bdb-8759-419f-63bf-8ed0d57650f0@gmail.com> <6ca7f428-eede-2c14-85fe-da4a20bcea0d@gmail.com> <5dd3378d-ac32-691e-1f80-7218a5d07fd6@oracle.com> <43c17501-8865-6e1f-1a92-d947755d8fa8@gmail.com> Message-ID: <4d386f6f-5212-1e42-abf7-1913f6218f05@gmail.com> Date: Thu, 31 May 2018 17:29:09 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/31/2018 10:51 AM, Oleksandr Andrushchenko wrote: > On 05/30/2018 10:24 PM, Boris Ostrovsky wrote: >> On 05/30/2018 01:46 PM, Oleksandr Andrushchenko wrote: >>> On 05/30/2018 06:54 PM, Boris Ostrovsky wrote: >>>> >>>> BTW, I also think you can further simplify >>>> xenmem_reservation_va_mapping_* routines by bailing out right away if >>>> xen_feature(XENFEAT_auto_translated_physmap). In fact, you might even >>>> make them inlines, along the lines of >>>> >>>> inline void xenmem_reservation_va_mapping_reset(unsigned long count, >>>>                       struct page **pages) >>>> { >>>> #ifdef CONFIG_XEN_HAVE_PVMMU >>>>      if (!xen_feature(XENFEAT_auto_translated_physmap)) >>>>          __xenmem_reservation_va_mapping_reset(...) >>>> #endif >>>> } >>> How about: >>> >>> #ifdef CONFIG_XEN_HAVE_PVMMU >>> static inline __xenmem_reservation_va_mapping_reset(struct page *page) >>> { >>> [...] >>> } >>> #endif >>> >>> and >>> >>> void xenmem_reservation_va_mapping_reset(unsigned long count, >>>                       struct page **pages) >>> { >>> #ifdef CONFIG_XEN_HAVE_PVMMU >>>      if (!xen_feature(XENFEAT_auto_translated_physmap)) { >>>          int i; >>> >>>          for (i = 0; i < count; i++) >>>              __xenmem_reservation_va_mapping_reset(pages[i]); >>>      } >>> #endif >>> } >>> >>> This way I can use __xenmem_reservation_va_mapping_reset(page); >>> instead of xenmem_reservation_va_mapping_reset(1, &page); >> >> Sure, this also works. > Could you please take look at the patch attached if this is what we want? Please ignore it, it is ugly ;) I have implemented this as you suggested: static inline void xenmem_reservation_va_mapping_update(unsigned long count,                      struct page **pages,                      xen_pfn_t *frames) { #ifdef CONFIG_XEN_HAVE_PVMMU     if (!xen_feature(XENFEAT_auto_translated_physmap))         __xenmem_reservation_va_mapping_update(count, pages, frames); #endif } >> -boris >> > Thank you, > Oleksandr