Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758518Ab0DHKM3 (ORCPT ); Thu, 8 Apr 2010 06:12:29 -0400 Received: from ns2.intersolute.de ([193.110.43.67]:45895 "EHLO ns2.intersolute.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755821Ab0DHKM1 (ORCPT ); Thu, 8 Apr 2010 06:12:27 -0400 Message-ID: <4BBDAC02.500@lumino.de> Date: Thu, 08 Apr 2010 12:12:18 +0200 From: Michael Schnell User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 SUSE/3.0.4-2.3 Thunderbird/3.0.4 MIME-Version: 1.0 To: Giuseppe Calderaro , linux-kernel , nios2-dev Subject: Re: atomic RAM ? References: <4BBD86A5.5030109@lumino.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1503 Lines: 31 On 04/08/2010 11:43 AM, Giuseppe Calderaro wrote: > > In the past I used the mutex connected to the avalon bus to get atomic > test and set instructions: > http://www.altera.com/literature/hb/nios2/n2cpu_nii51020.pdf > Of course I do know the Altera hardware Mutex, but same just implements a single Mutex. To allow for FUTEX, which is the base of doing threaded application with the pthread functions provided by libc, the application programmer can create any number of pthread_mutex'es (of course a decent restriction by hardware to some 1000 would usually not harm with typical embedded applications). Of course a multithreaded application should not be done in an architecture depending way, but should be compilable for any arch and thus the count of allowable pthread_mutex'es should not be greatly restricted by the underlying hardware (be it NIOS or whatever else). Of course you are right that using custom instructions to do a decent count of atomic (hardware-) mutex'es necessary for implementing decent SMP aware FUTEX (or even Kernel Mutex) stuff with NIOS and similar archs is not strictly necessary, but I think it's handy to use them instead of I/O-elements, as the MMU would disallow user space access to "normal" I/O addresses. Michael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/