lkml.org 
[lkml]   [2022]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 07/10] tmp, tmp_tis: Implement usage counter for locality
On Mon, Jul 04, 2022 at 07:45:12PM +0200, Lino Sanfilippo wrote:
>
>
> On 01.07.22 01:29, Jarkko Sakkinen wrote:
>
> >
> > I'm kind of thinking that should tpm_tis_data have a lock for its
> > contents?
>
> Most of the tpm_tis_data structure elements are set once during init and
> then never changed but only read. So no need for locking for these. The
> exceptions I see are
>
> - flags
> - locality_count
> - locality

I'd still go for single data struct lock, since this lock would
be taken in every transmit flow. It makes the whole thing easier
to maintain over time, and does not really affect scalability.

This brings me to another question: what does this lock protect
against given that tpm_try_get_ops() already takes tpm_mutex?
It's not clear and that should be somehow reasoned in the commit
message.

Anyway, *if* a lock is needed the granularity should be the whole
struct.

BR, Jarkko

\
 
 \ /
  Last update: 2022-07-11 04:52    [W:0.105 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site