drivers: video: rockchip: vcodec_dma_map_sg maybe fail
[firefly-linux-kernel-4.4.55.git] / drivers / hv / hv.c
index 6341be8739ae6e3a4931912a6fcd3139a0314c4c..57c1917986995af7e8b09a18cb4a27138084f235 100644 (file)
@@ -219,7 +219,7 @@ int hv_init(void)
        /* See if the hypercall page is already set */
        rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
 
-       virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
+       virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_RX);
 
        if (!virtaddr)
                goto cleanup;
@@ -293,8 +293,14 @@ void hv_cleanup(void)
         * Cleanup the TSC page based CS.
         */
        if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
-               clocksource_change_rating(&hyperv_cs_tsc, 10);
-               clocksource_unregister(&hyperv_cs_tsc);
+               /*
+                * Crash can happen in an interrupt context and unregistering
+                * a clocksource is impossible and redundant in this case.
+                */
+               if (!oops_in_progress) {
+                       clocksource_change_rating(&hyperv_cs_tsc, 10);
+                       clocksource_unregister(&hyperv_cs_tsc);
+               }
 
                hypercall_msr.as_uint64 = 0;
                wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
@@ -416,7 +422,7 @@ int hv_synic_alloc(void)
                goto err;
        }
 
-       for_each_online_cpu(cpu) {
+       for_each_present_cpu(cpu) {
                hv_context.event_dpc[cpu] = kmalloc(size, GFP_ATOMIC);
                if (hv_context.event_dpc[cpu] == NULL) {
                        pr_err("Unable to allocate event dpc\n");
@@ -455,6 +461,8 @@ int hv_synic_alloc(void)
                        pr_err("Unable to allocate post msg page\n");
                        goto err;
                }
+
+               INIT_LIST_HEAD(&hv_context.percpu_list[cpu]);
        }
 
        return 0;
@@ -479,7 +487,7 @@ void hv_synic_free(void)
        int cpu;
 
        kfree(hv_context.hv_numa_map);
-       for_each_online_cpu(cpu)
+       for_each_present_cpu(cpu)
                hv_synic_free_cpu(cpu);
 }
 
@@ -549,8 +557,6 @@ void hv_synic_init(void *arg)
        rdmsrl(HV_X64_MSR_VP_INDEX, vp_index);
        hv_context.vp_index[cpu] = (u32)vp_index;
 
-       INIT_LIST_HEAD(&hv_context.percpu_list[cpu]);
-
        /*
         * Register the per-cpu clockevent source.
         */