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

This reverts commit b3c54971ba.

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-20 13:06:44 -07:00 committed by Will Deacon
parent e43c6c7330
commit a45661e426
1 changed files with 5 additions and 19 deletions

View File

@ -52,9 +52,7 @@ early_param("no-steal-acc", parse_no_stealacc);
/* return stolen time in ns by asking the hypervisor */
static u64 para_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);
@ -63,38 +61,28 @@ static u64 para_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;
@ -105,12 +93,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;