All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: Remove unnecessary divide operations
Date: Thu, 01 Jul 2010 17:18:13 +0300	[thread overview]
Message-ID: <4C2CA3A5.2040802@redhat.com> (raw)
In-Reply-To: <1277992812-31945-2-git-send-email-joerg.roedel@amd.com>

On 07/01/2010 05:00 PM, Joerg Roedel wrote:
> This patch converts unnecessary divide and modulo operations
> in the KVM large page related code into logical operations.
> This allows to convert gfn_t to u64 while not breaking 32
> bit builds.
>
>
>   #define KVM_NR_PAGE_SIZES 2
> -#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + ((x) - 1) * 8)
> +#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 8)
> +#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
>   #define KVM_HPAGE_SIZE(x) (1UL<<  KVM_HPAGE_SHIFT(x))
>   #define KVM_HPAGE_MASK(x)	(~(KVM_HPAGE_SIZE(x) - 1))
>    

In theory, KVM_HPAGE_SIZE() needs s/1UL/(u64)1/, or KVM_HPAGE_MASK 
becomes truncated if used against a gfn_t.  In practice, KVM_HPAGE_MASK 
is not used at all, so this doesn't matter.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-07-01 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 14:00 [PATCH 0/2] Use u64 for gfn_t in KVM Joerg Roedel
2010-07-01 14:00 ` [PATCH 1/2] KVM: Remove unnecessary divide operations Joerg Roedel
2010-07-01 14:18   ` Avi Kivity [this message]
2010-07-01 14:00 ` [PATCH 2/2] KVM: Use u64 for frame data types Joerg Roedel
2010-07-01 14:18 ` [PATCH 0/2] Use u64 for gfn_t in KVM Avi Kivity
2010-07-02 17:19 ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C2CA3A5.2040802@redhat.com \
    --to=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.