From: Jiri Slaby <jirislaby@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: avi@redhat.com, linux-kernel@vger.kernel.org,
Marcelo Tosatti <mtosatti@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Gleb Natapov <gleb@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Gregory Haskins <ghaskins@novell.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH] x86: KVM, fix lock imbalance
Date: Wed, 07 Jul 2010 15:12:15 +0200 [thread overview]
Message-ID: <4C347D2F.3080908@gmail.com> (raw)
In-Reply-To: <4C347C0E.6020107@gmail.com>
On 07/07/2010 03:07 PM, Jiri Slaby wrote:
>>> --- a/arch/x86/kvm/i8254.c
>>> +++ b/arch/x86/kvm/i8254.c
>>> @@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
>>>
>>> pit->wq = create_singlethread_workqueue("kvm-pit-wq");
>>> if (!pit->wq) {
>>> + mutex_unlock(&pit->pit_state.lock);
>>> kfree(pit);
>>> return NULL;
>>> }
>>
>> A cleanliness comment: why is that tear-down/dealloc sequence open-coded? It
>> should be at the end of the function, with goto labels, like we do it in
>> similar cases.
>
> Because the lock is around a block only. I usually don't create a goto
> fail-paths in these cases.
To be more precise what I mean by that:
if ()
return;
lock();
...
if () { [single if inside the crit section]
unlock();
return;
}
...
unlock()
...
if ()
return;
...
if ()
return;
--
js
next prev parent reply other threads:[~2010-07-07 13:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-07 13:02 [PATCH] x86: KVM, fix lock imbalance Jiri Slaby
2010-07-07 13:05 ` Ingo Molnar
2010-07-07 13:07 ` Jiri Slaby
2010-07-07 13:12 ` Jiri Slaby [this message]
2010-07-07 13:21 ` Avi Kivity
2010-07-07 14:10 ` Ingo Molnar
2010-07-07 14:14 ` Avi Kivity
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=4C347D2F.3080908@gmail.com \
--to=jirislaby@gmail.com \
--cc=avi@redhat.com \
--cc=ghaskins@novell.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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.