* [GIT PULL] kvm oops fix
@ 2007-04-19 15:50 Avi Kivity
2007-04-19 16:53 ` Linus Torvalds
2007-04-20 4:54 ` [kvm-devel] " David Brown
0 siblings, 2 replies; 10+ messages in thread
From: Avi Kivity @ 2007-04-19 15:50 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, kvm-devel
Linus,
Please pull from the 'linus' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git
To get a one-liner fixing a host oops running non-pae guests.
Avi Kivity (1):
KVM: Fix off-by-one when writing to a nonpae guest pde
---
drivers/kvm/mmu.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
commit 6b8d0f9b180cb93513bb65f705b299370f0357a1
Author: Avi Kivity <avi@qumranet.com>
Date: Wed Apr 18 11:18:18 2007 +0300
KVM: Fix off-by-one when writing to a nonpae guest pde
Nonpae guest pdes are shadowed by two pae ptes, so we double the offset
twice: once to account for the pte size difference, and once because we
need to shadow pdes for a single guest pde.
But when writing to the upper guest pde we also need to truncate the
lower bits, otherwise the multiply shifts these bits into the pde index
and causes an access to the wrong shadow pde. If we're at the end of the
page (accessing the very last guest pde) we can even overflow into the
next host page and oops.
Signed-off-by: Avi Kivity <avi@qumranet.com>
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index e85b4c7..cab26f3 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -1171,6 +1171,7 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
* and zap two pdes instead of one.
*/
if (level == PT32_ROOT_LEVEL) {
+ page_offset &= ~7; /* kill rounding error */
page_offset <<= 1;
npte = 2;
}
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [GIT PULL] kvm oops fix 2007-04-19 15:50 [GIT PULL] kvm oops fix Avi Kivity @ 2007-04-19 16:53 ` Linus Torvalds 2007-04-19 19:09 ` Jeff Garzik 2007-04-20 4:54 ` [kvm-devel] " David Brown 1 sibling, 1 reply; 10+ messages in thread From: Linus Torvalds @ 2007-04-19 16:53 UTC (permalink / raw) To: Avi Kivity; +Cc: linux-kernel, kvm-devel On Thu, 19 Apr 2007, Avi Kivity wrote: > > Please pull from the 'linus' branch of > > git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git *please* put the branch-name after the git repo, so that I can cut-and-paste without noticing only afterwards that the diffstat doesn't match what it was supposed to, and I got the wrong commits, and have to undo and re-do the pull.. Yeah, I didn't do that mistake this time, and in fact, I seldom do, but every time the branch is mentioned somewhere else than with the actual repo to pull, I get nervous. So I've said this a million times before, but I'll say it one more time: if it's not the main branch, the message should be Please pull from the 'linus' branch of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git linus to get the following changes: ... so that when I cut-and-paste the URL (you didn't think I'd try to type it in by hand, did you?) I get the branch automatically. Linus ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] kvm oops fix 2007-04-19 16:53 ` Linus Torvalds @ 2007-04-19 19:09 ` Jeff Garzik 2007-04-19 19:24 ` [kvm-devel] " David Brown 2007-04-19 20:30 ` Linus Torvalds 0 siblings, 2 replies; 10+ messages in thread From: Jeff Garzik @ 2007-04-19 19:09 UTC (permalink / raw) To: Linus Torvalds; +Cc: Avi Kivity, linux-kernel, kvm-devel Linus Torvalds wrote: > > On Thu, 19 Apr 2007, Avi Kivity wrote: >> Please pull from the 'linus' branch of >> >> git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git > > *please* put the branch-name after the git repo, so that I can > cut-and-paste without noticing only afterwards that the diffstat doesn't > match what it was supposed to, and I got the wrong commits, and have to > undo and re-do the pull.. What is the easiest way to completely undo a pull, reverting the branch to the HEAD present before the pull? Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-devel] [GIT PULL] kvm oops fix 2007-04-19 19:09 ` Jeff Garzik @ 2007-04-19 19:24 ` David Brown 2007-04-19 19:34 ` Jeff Garzik 2007-04-19 20:30 ` Linus Torvalds 1 sibling, 1 reply; 10+ messages in thread From: David Brown @ 2007-04-19 19:24 UTC (permalink / raw) To: Jeff Garzik; +Cc: Linus Torvalds, kvm-devel, linux-kernel > What is the easiest way to completely undo a pull, reverting the branch > to the HEAD present before the pull? > If the pull doesn't merge successfully then usually doing a `git-reset --hard` will blow everything away back to normal, but Linus may do different things. - David Brown ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-devel] [GIT PULL] kvm oops fix 2007-04-19 19:24 ` [kvm-devel] " David Brown @ 2007-04-19 19:34 ` Jeff Garzik 2007-04-19 19:40 ` J. Bruce Fields 0 siblings, 1 reply; 10+ messages in thread From: Jeff Garzik @ 2007-04-19 19:34 UTC (permalink / raw) To: David Brown; +Cc: Linus Torvalds, kvm-devel, linux-kernel David Brown wrote: >> What is the easiest way to completely undo a pull, reverting the branch >> to the HEAD present before the pull? >> > > If the pull doesn't merge successfully then usually doing a `git-reset > --hard` will blow everything away back to normal, but Linus may do > different things. I'm thinking about a successful pull that one later regrets :) Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-devel] [GIT PULL] kvm oops fix 2007-04-19 19:34 ` Jeff Garzik @ 2007-04-19 19:40 ` J. Bruce Fields 0 siblings, 0 replies; 10+ messages in thread From: J. Bruce Fields @ 2007-04-19 19:40 UTC (permalink / raw) To: Jeff Garzik; +Cc: David Brown, Linus Torvalds, kvm-devel, linux-kernel On Thu, Apr 19, 2007 at 03:34:01PM -0400, Jeff Garzik wrote: > David Brown wrote: > >>What is the easiest way to completely undo a pull, reverting the branch > >>to the HEAD present before the pull? > >> > > > >If the pull doesn't merge successfully then usually doing a `git-reset > >--hard` will blow everything away back to normal, but Linus may do > >different things. > > I'm thinking about a successful pull that one later regrets :) git reset --hard ORIG_HEAD, if the pull is the last thing you did. Otherwise maybe fire up gitk, look for the point you'd like to revert to, and cut-n-paste the SHA1 ID to the git reset --hard commandline. --b. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] kvm oops fix 2007-04-19 19:09 ` Jeff Garzik 2007-04-19 19:24 ` [kvm-devel] " David Brown @ 2007-04-19 20:30 ` Linus Torvalds 2007-04-19 22:59 ` Linus Torvalds 1 sibling, 1 reply; 10+ messages in thread From: Linus Torvalds @ 2007-04-19 20:30 UTC (permalink / raw) To: Jeff Garzik; +Cc: Avi Kivity, linux-kernel, kvm-devel On Thu, 19 Apr 2007, Jeff Garzik wrote: > > What is the easiest way to completely undo a pull, reverting the branch to the > HEAD present before the pull? You can either do git reset --hard ORIG_HEAD (git will set ORIG_HEAD before things like pulls or resets, so you can always go back), or, if you have reflogs enabled (and if you set up your repository with a modern git version it probably will be enabled by default), you can just do git reset --hard @{1} where "@{1}" just means "HEAD ref state one change ago" (the same way you can say "@{2.hours.ago}" to mean HEAD state two hours ago). In either case, double-check that that is indeed the version you want to revert to with git log ORIG_HEAD or git log @{1} first, since obviously if you give "git reset --hard" the wrong version, it will reset to the wrong state. Although especially with reflogs, your previous state will always be logged, so you can always re-do what you undid by (again) doing "git reset --hard @{1}" to get back the previous state ;) ALSO! Make sure that you don't have any dirty state in your working tree that you don't want to lose! "git reset --hard" will do what it implies: it will reset your tree. Very much including throwing away all your dirty state (and that you can't get back by going to a previous commit, since it was never committed!) Linus ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [GIT PULL] kvm oops fix 2007-04-19 20:30 ` Linus Torvalds @ 2007-04-19 22:59 ` Linus Torvalds 0 siblings, 0 replies; 10+ messages in thread From: Linus Torvalds @ 2007-04-19 22:59 UTC (permalink / raw) To: Jeff Garzik; +Cc: Avi Kivity, linux-kernel, kvm-devel On Thu, 19 Apr 2007, Linus Torvalds wrote: > > You can either do > > git reset --hard ORIG_HEAD > git reset --hard @{1} Btw, on the same kind of subject: the whole "what was my previous HEAD" issues are obviously also how you'd generally want to see what those new patches were, regardless of whether you want to undo them or not. So it might be worth repeating for people what I do after any pull that I feel I want to give a quick look-over.. A simple gitk ORIG_HEAD.. or gitk HEAD@{1}.. or gitk @{1}.. or gitk @{12.hours.ago}.. are all variations of the same theme: show what is new since either "last update" or "what I had in my tree 12 hours ago". Btw, the gitk @{12.hours.ago}.. thing is very different from gitk --since=12.hours.ago even if they involve the same date. The "@{12.hours.ago}" syntax pinpoints a particular *commit*, namely what your HEAD was pointing at 12 hours ago. So it's literally about your particular repository history (give a branch name if you want to specify one: so "for-linus@{2.hours.ago}" specifies the *commit* that was the head of the "for-linus" branch in your repository 2 hours ago). In contrast, the "--since=12.hours.ago" means something totally different: it measn that you want to ignore all commits that are older than 12 hours, regardless of whether they were actually in your tree at that point or not. Which is often a very different issue indeed. So another reasonably common things you can do: git fetch linus gitk linus@{1}..linus this assumes that you've set up a separate tracking branch "linus", and that you've taught it to fetch my current tree into it. So in the above sequence, the "git fetch linus" will fetch everything new from my tree into your "linus" tracking branch, and the "gitk" will then show all the new commits on that branch that you got. NOTE! The above is very much designed to work whether you are on that branch or not, and in fact, the normal reason to do something like the above is explicitly that you want to see what is going on in somebody elses tree without actually necessarily merging it into your own branch (perhaps in order to decide whether you _want_ to merge it or not). And that "linus@{1}" really just means "what is the previous commit I had on my 'linus' branch". You can obviously dig deeper down, and "linus@{10}" is something less commonly used, but basically means "what was on that branch ten revision updates ago". Note that this is *very*different* from "linus~10", which means "what is the tenth _parent_ of the "linus" branch. They *can* be the same thing (if each operation adds exactly one commit), but if you do things like "git fetch", then the "linus" branch ten operations ago may be hundreds of commits ago, because some of those ten operations may have added lots of commits thanks to synching up with some other tree! And as already noted, the "branch@{xyzzy}" format also allows "xyzzy" to be a date, not just a numeral. In fact, that was the original revlog tracking behaviour, and the numeric thing, while simpler, is actually a newer feature (as is the "don't specify a branch name at all", which just means "current branch") So gitk @{24.hours.ago}.. is a nice way to see what has happend in *your* repository, on the current branch, in the last 24 hours. (NOTE: You can also say "HEAD@{2.hours.ago}" and that actually doesn't use the current branch at all, it actually says what HEAD was 2 hours ago: you may have been on some totally _different_ branch back then, and if you wonder what the heck of a branch you are running and you look at the time of the binary, but you don't remember what branch you had checked out when you built it, that may be what you want. Of course, you may also want a better attention span ;) Some of this is pretty recent, and generally, if some of this doesn't work for you, it means that you are using some ancient version of git. If it's not git-1.5.x, upgrade. It's worth it. Linus ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-devel] [GIT PULL] kvm oops fix 2007-04-19 15:50 [GIT PULL] kvm oops fix Avi Kivity 2007-04-19 16:53 ` Linus Torvalds @ 2007-04-20 4:54 ` David Brown 2007-04-22 5:52 ` Avi Kivity 1 sibling, 1 reply; 10+ messages in thread From: David Brown @ 2007-04-20 4:54 UTC (permalink / raw) To: Avi Kivity; +Cc: Linus Torvalds, kvm-devel, linux-kernel On 4/19/07, Avi Kivity <avi@qumranet.com> wrote: > Linus, > > Please pull from the 'linus' branch of > > git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git > > To get a one-liner fixing a host oops running non-pae guests. > > Avi Kivity (1): > KVM: Fix off-by-one when writing to a nonpae guest pde Ooo I thought of something else. Should this be applied to the current 2.6.20.7 for the next 2.6.20.8 release? - David Brown ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [kvm-devel] [GIT PULL] kvm oops fix 2007-04-20 4:54 ` [kvm-devel] " David Brown @ 2007-04-22 5:52 ` Avi Kivity 0 siblings, 0 replies; 10+ messages in thread From: Avi Kivity @ 2007-04-22 5:52 UTC (permalink / raw) To: David Brown; +Cc: Linus Torvalds, kvm-devel, linux-kernel David Brown wrote: > On 4/19/07, Avi Kivity <avi@qumranet.com> wrote: >> Linus, >> >> Please pull from the 'linus' branch of >> >> git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git >> >> To get a one-liner fixing a host oops running non-pae guests. >> >> Avi Kivity (1): >> KVM: Fix off-by-one when writing to a nonpae guest pde > > Ooo I thought of something else. > Should this be applied to the current 2.6.20.7 for the next 2.6.20.8 > release? > Yes. I'll prepare a patch. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-04-22 5:52 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-04-19 15:50 [GIT PULL] kvm oops fix Avi Kivity 2007-04-19 16:53 ` Linus Torvalds 2007-04-19 19:09 ` Jeff Garzik 2007-04-19 19:24 ` [kvm-devel] " David Brown 2007-04-19 19:34 ` Jeff Garzik 2007-04-19 19:40 ` J. Bruce Fields 2007-04-19 20:30 ` Linus Torvalds 2007-04-19 22:59 ` Linus Torvalds 2007-04-20 4:54 ` [kvm-devel] " David Brown 2007-04-22 5:52 ` Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox