[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Sigsegv error when create JVM, called by bdrv_create in
From: |
harryxiyou |
Subject: |
Re: [Qemu-devel] Sigsegv error when create JVM, called by bdrv_create in block.c |
Date: |
Fri, 8 Feb 2013 13:17:54 +0800 |
On Fri, Feb 8, 2013 at 12:11 AM, Peter Maydell <address@hidden> wrote:
> On 7 February 2013 16:08, Stefan Hajnoczi <address@hidden> wrote:
>> On Thu, Feb 7, 2013 at 3:12 PM, harryxiyou <address@hidden> wrote:
>>> The above debug info show jni will be used in coroutine. I do not
>>> familay with coroutine, however I guess if coroutine not allow to
>>> spawn a new thread? ,or it's stack corrupte with java jvm stack ? ,
>>> For when I modify bdrv_create out of coroutine , it can work - connect
>>> to hdfs without any probleme.
>>
>> Coroutines are allowed to create new threads.
>>
>> Coroutine stacks do not grow automatically but they have 1 MB, which
>> should be enough.
>>
>> There are a number of other things that could be wrong here -
>> missing/incorrect thread synchronization, the shared libraries you are
>> importing messing with the environment (signal masks, signal
>> handlers), etc.
>
> I would suggest that trying to start an entire JVM from within
> QEMU is likely to be brittle at best even if you do get it to
> work, because you've got two big complicated codebases which
> will probably squabble over threads, signal handling, etc etc,
> because they weren't intended to work as part of some other
> large process.
>
Hi:Peter,Stefan
Can I modify block.c , like below ? - make bdrv_create_co_entry
called out of coroutine ! . Or who can give me a elegant way to
call jni function in coroutine!
/***********************************************************************
int bdrv_create(BlockDriver *drv, const char* filename,
QEMUOptionParameter *options)
{
int ret;
Coroutine *co;
CreateCo cco = {
.drv = drv,
.filename = g_strdup(filename),
.options = options,
.ret = NOT_DONE,
};
if (!drv->bdrv_create) {
ret = -ENOTSUP;
goto out;
}
#if 1
bdrv_create_co_entry(&cco);
#else
if (qemu_in_coroutine()) {
/* Fast-path if already in coroutine context */
bdrv_create_co_entry(&cco);
} else {
co = qemu_coroutine_create(bdrv_create_co_entry);
qemu_coroutine_enter(co, &cco);
while (cco.ret == NOT_DONE) {
qemu_aio_wait();
}
}
#endif
ret = cco.ret;
out:
g_free(cco.filename);
return ret;
}
/*****************************************************************************
--
Thanks
Kang Hua