lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55020142.80202@codeaurora.org>
Date:	Thu, 12 Mar 2015 14:12:34 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Lina Iyer <lina.iyer@...aro.org>
CC:	bjorn.andersson@...ymobile.com, linux-arm-msm@...r.kernel.org,
	jhugo@...eaurora.org, agross@...eaurora.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Lock 7 is cpuidle specific, use non-generic value for
 locking

On 03/12/15 13:48, Lina Iyer wrote:
> On Thu, Mar 12 2015 at 14:35 -0600, Stephen Boyd wrote:
>> On 03/12/15 12:38, Lina Iyer wrote:
>>> ---
>>
>> sign off?
>>
> :) I was just hacking it to make it easier to understand. Sure.
>
>>>  drivers/hwspinlock/qcom_hwspinlock.c | 15 +++++++++++----
>>>  1 file changed, 11 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/hwspinlock/qcom_hwspinlock.c
>>> b/drivers/hwspinlock/qcom_hwspinlock.c
>>> index 93b62e0..7642524 100644
>>> --- a/drivers/hwspinlock/qcom_hwspinlock.c
>>> +++ b/drivers/hwspinlock/qcom_hwspinlock.c
>>> @@ -25,16 +25,23 @@
>>>
>>>  #include "hwspinlock_internal.h"
>>>
>>> -#define QCOM_MUTEX_APPS_PROC_ID    1
>>> -#define QCOM_MUTEX_NUM_LOCKS    32
>>> +#define QCOM_MUTEX_APPS_PROC_ID        1
>>> +#define QCOM_MUTEX_CPUIDLE_OFFSET    128
>>> +#define QCOM_CPUIDLE_LOCK        7
>>> +#define QCOM_MUTEX_NUM_LOCKS        32
>>>
>>>  static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
>>>  {
>>>      struct regmap_field *field = lock->priv;
>>>      u32 lock_owner;
>>>      int ret;
>>> +    u32 proc_id;
>>>
>>> -    ret = regmap_field_write(field, QCOM_MUTEX_APPS_PROC_ID);
>>> +    proc_id = hwspin_lock_get_id(lock) == QCOM_CPUIDLE_LOCK ?
>>> +            QCOM_MUTEX_CPUIDLE_OFFSET + smp_processor_id():
>>
>> So we assume that the caller will always be the CPU that is locking the
>> lock? Also, do we assume that the remote side knows our CPU scheme here?
>> smp_processor_id() returns the logical CPU and not the physical CPU
>> number so hopefully the remote side doesn't care about logical CPU
>> numbers being written to the lock value.
>
> The remote side (SCM) doesnt care the value written. We use 128+cpu to
> be unique in Linux(128 is to make sure it doesnt clash with predefined
> values used across by other processors.
>
>

It looks like the remote side unlocks it too? It doesn't seem like this
will work with the framework very well. The framework has a kernel
spinlock attached to the hwspinlock so when we lock the hwspinlock we
also lock the kernel spinlock and we only release the kernel spinlock
when the kernel unlocks the hwspinlock. In this case it seems like
cpuidle wants to have it's own kernel spinlock and just use the trylock
loop part of __hwspin_lock_timeout() without taking any kernel side
locks. Plus it wants to write a specific value to the lock.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ