Revert "FROMLIST: arm64: paravirt: Use RCU read locks to guard stolen_time"

This reverts commit 67bef07aab.

Reason for revert: switching to latest version merged into Linus's tree.

Bug: 231271475
Change-Id: I27745412e9ffbd4685d54c06e3aa975eb23347fa
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Will Deacon <willdeacon@google.com>
This commit is contained in:
Elliot Berman
2022-05-23 08:53:26 -07:00
committed by Will Deacon
parent e9dd78ebe1
commit 0db47d8194

View File

@@ -47,9 +47,7 @@ early_param("no-steal-acc", parse_no_stealacc);
/* return stolen time in ns by asking the hypervisor */
static u64 pv_steal_clock(int cpu)
{
struct pvclock_vcpu_stolen_time *kaddr = NULL;
struct pv_time_stolen_time_region *reg;
u64 ret = 0;
reg = per_cpu_ptr(&stolen_time_region, cpu);
@@ -58,38 +56,28 @@ static u64 pv_steal_clock(int cpu)
* online notification callback runs. Until the callback
* has run we just return zero.
*/
rcu_read_lock();
kaddr = rcu_dereference(reg->kaddr);
if (!kaddr) {
rcu_read_unlock();
if (!reg->kaddr)
return 0;
}
ret = le64_to_cpu(READ_ONCE(kaddr->stolen_time));
rcu_read_unlock();
return ret;
return le64_to_cpu(READ_ONCE(reg->kaddr->stolen_time));
}
static int stolen_time_cpu_down_prepare(unsigned int cpu)
{
struct pvclock_vcpu_stolen_time *kaddr = NULL;
struct pv_time_stolen_time_region *reg;
reg = this_cpu_ptr(&stolen_time_region);
if (!reg->kaddr)
return 0;
kaddr = reg->kaddr;
rcu_assign_pointer(reg->kaddr, NULL);
synchronize_rcu();
memunmap(kaddr);
memunmap(reg->kaddr);
memset(reg, 0, sizeof(*reg));
return 0;
}
static int stolen_time_cpu_online(unsigned int cpu)
{
struct pvclock_vcpu_stolen_time *kaddr = NULL;
struct pv_time_stolen_time_region *reg;
struct arm_smccc_res res;
@@ -100,12 +88,10 @@ static int stolen_time_cpu_online(unsigned int cpu)
if (res.a0 == SMCCC_RET_NOT_SUPPORTED)
return -EINVAL;
kaddr = memremap(res.a0,
reg->kaddr = memremap(res.a0,
sizeof(struct pvclock_vcpu_stolen_time),
MEMREMAP_WB);
rcu_assign_pointer(reg->kaddr, kaddr);
if (!reg->kaddr) {
pr_warn("Failed to map stolen time data structure\n");
return -ENOMEM;