public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: penberg@kernel.org, asias.hejun@gmail.com,
	prasadjoshi124@gmail.com, avi@redhat.com, gorcunov@gmail.com,
	kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] kvm tools: Add memory gap for larger RAM sizes
Date: Wed, 11 May 2011 09:15:04 +0200	[thread overview]
Message-ID: <20110511071504.GH22551@elte.hu> (raw)
In-Reply-To: <1305086951-31698-1-git-send-email-levinsasha928@gmail.com>


* Sasha Levin <levinsasha928@gmail.com> wrote:

> Add a memory gap between 0xe0000000 and 0x100000000
> when using more than 0xe0000000 bytes for guest RAM.
> 
> This space is used by several things, PCI configuration
> space for example.
> 
> This patch updates the e820 table, slot allocations
> used for KVM_SET_USER_MEMORY_REGION, and the address
> translation.

Btw., in changelogs you really want to mention the *motivation* and effect of 
patches - not just the workings of the patch. Everyone can see what a patch 
does, so the motivation and effects are a lot more important and should be 
mentioned first in the patch - explaining how the patch does it is a distant 
third factor in terms of changelog-content importance ...

If someone reads these without context he has no idea that these patches are 
fixing crashes and memory corruption with guest RAM sizes that cross the 4GB 
boundary.

> +	if (kvm->ram_size < 0xe0000000) {
> +			.size		= 0xe0000000 - BZ_KERNEL_START,
> +			.size		= kvm->ram_size - 0xe0000000 - BZ_KERNEL_START,
> +	 * We have a gap between 0xe0000000 and 0x100000000.
> +	if (offset < 0xe0000000)
> +		return self->ram_start + 0xe0000000 + (offset - 0x100000000);
> +	if (self->ram_size < 0xe0000000) {
> +		kvm_register_mem_slot(self, 0, 0, 0xe0000000, (u64)self->ram_start);
> +		kvm_register_mem_slot(self, 1, 0x100000000ULL, self->ram_size - 0xe0000000, (u64)self->ram_start + 0xe0000000);

0xe0000000 is repeated 9 times in the code!

We tend to add symbols when values are repeated only twice. Often we add a 
symbol and an explanation when a magic value is used only *once*.

It is absolutely vital to define a symbol for this and document that it means 
and why we need it.

Thanks,

	Ingo

      parent reply	other threads:[~2011-05-11 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  4:09 [PATCH 1/3] kvm tools: Add memory gap for larger RAM sizes Sasha Levin
2011-05-11  4:09 ` [PATCH 2/3 V2] kvm tools: Prevent PFN wraparound Sasha Levin
2011-05-11 11:15   ` Ingo Molnar
2011-05-11  4:09 ` [PATCH 3/3] kvm tools: Use definitions from kernel headers Sasha Levin
2011-05-11 10:59   ` Ingo Molnar
2011-05-11  7:15 ` Ingo Molnar [this message]

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=20110511071504.GH22551@elte.hu \
    --to=mingo@elte.hu \
    --cc=asias.hejun@gmail.com \
    --cc=avi@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox