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]
Date:	Sun, 8 Nov 2015 06:01:08 +0200
From:	Octavian Purdila <octavian.purdila@...el.com>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Linux-Arch <linux-arch@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Hajime Tazaki <thehajime@...il.com>
Subject: Re: [RFC PATCH 21/28] lkl tools: host lib: posix host operations

On Sun, Nov 8, 2015 at 1:16 AM, Arnd Bergmann <arnd@...db.de> wrote:
> On Tuesday 03 November 2015 22:20:52 Octavian Purdila wrote:
>> +struct pthread_sem {
>> +     pthread_mutex_t lock;
>> +     int count;
>> +     pthread_cond_t cond;
>> +};
>> +
>> +static void *sem_alloc(int count)
>> +{
>> +     struct pthread_sem *sem;
>> +
>> +     sem = malloc(sizeof(*sem));
>> +     if (!sem)
>> +             return NULL;
>> +
>> +     pthread_mutex_init(&sem->lock, NULL);
>> +     sem->count = count;
>> +     pthread_cond_init(&sem->cond, NULL);
>> +
>> +     return sem;
>> +}
>
> What is the reason to have generalized semaphores in the
> host API rather than a simple mutex?
>

Currently waking up from idle after an IRQ event requires a semaphore.
I'll see if we can use a simple mutex for this.

>> +static unsigned long long time_ns(void)
>> +{
>> +     struct timeval tv;
>> +
>> +     gettimeofday(&tv, NULL);
>> +
>> +     return tv.tv_sec * 1000000000ULL + tv.tv_usec * 1000ULL;
>> +}
>
> clock_gettime() has been around since POSIX.1-2001 and provides the
> nanosecond resolution you use in the interface.
>

Good point, I will change it to clock_gettime.

Thanks for the review Arnd !
--
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