- 论坛徽章:
- 0
|
本帖最后由 ljy23374 于 2013-02-02 09:38 编辑
我们最近遇到个问题,在装linux OS(已经测试了BOSS linux和ubuntu)的情况下,休眠唤醒会有概率(3%~4%)的失败,BOSS下会重启,ubuntu下死机,windows下测试是没问题的。在查看kern.log文件后发现,出问题的时候OS在进休眠状态时并没有去创建hibernate image,所以唤醒时候OS找不到hibernate image才导致了重启或死机的问题,这是log文件:
Jul 11 02:50:32 ub-HEC41 kernel: [ 1371.198676] PM: Marking nosave pages: [mem 0x20000000-0x201fffff]
Jul 11 02:50:32 ub-HEC41 kernel: [ 1371.198687] PM: Basic memory bitmaps created
休眠异常的时候下面的信息没有打印
Jul 11 02:51:27 ub-HEC41 kernel: [ 1371.198688] PM: Syncing filesystems ... done.
Jul 11 02:51:27 ub-HEC41 kernel: [ 1371.365295] Freezing user space processes ... (elapsed 0.01 seconds) done.
Jul 11 02:51:27 ub-HEC41 kernel: [ 1371.378946] PM: Preallocating image memory... done (allocated 191509 pages)
......
查看内核代码hibernate.c文件:
int create_basic_memory_bitmaps(void)
{
struct memory_bitmap *bm1, *bm2;
int error = 0;
BUG_ON(forbidden_pages_map || free_pages_map);
bm1 = kzalloc(sizeof(struct memory_bitmap), GFP_KERNEL);
if (!bm1)
return -ENOMEM;
error = memory_bm_create(bm1, GFP_KERNEL, PG_ANY);
if (error)
goto Free_first_object;
bm2 = kzalloc(sizeof(struct memory_bitmap), GFP_KERNEL);
if (!bm2)
goto Free_first_bitmap;
error = memory_bm_create(bm2, GFP_KERNEL, PG_ANY);
if (error)
goto Free_second_object;
forbidden_pages_map = bm1;
free_pages_map = bm2;
mark_nosave_pages(forbidden_pages_map);
pr_debug("PM: Basic memory bitmaps created\n");
return 0;
Free_second_object:
kfree(bm2);
Free_first_bitmap:
memory_bm_free(bm1, PG_UNSAFE_CLEAR);
Free_first_object:
kfree(bm1);
return -ENOMEM;
}
int hibernate(void)
{
int error;
lock_system_sleep();
/* The snapshot device should not be opened while we're running */
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
error = -EBUSY;
goto Unlock;
}
pm_prepare_console();
error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
if (error)
goto Exit;
/* Allocate memory management structures */
error = create_basic_memory_bitmaps();
if (error)
goto Exit;
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");,
从这两个函数我们可以发现Jul 11 02:50:32 ub-HEC41 kernel: [ 1371.198687] PM: Basic memory bitmaps created之后就应该执行printk(KERN_INFO "PM: Syncing filesystems ... ")了,为什么在这两个print之间会有异常呢,恳求指点,kernel或者BIOS都可以,欢迎走过路过的大虾们多提宝贵意见! |
|