Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Nov 2008 11:27:13 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Alexander Motin <mav@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r184558 - head/sys/dev/acpica/Osd
Message-ID:  <200811031127.14928.jkim@FreeBSD.org>
In-Reply-To: <490F21FC.1020508@FreeBSD.org>
References:  <200811021250.mA2CoGs1038957@svn.freebsd.org> <200811031050.48765.jkim@FreeBSD.org> <490F21FC.1020508@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 03 November 2008 11:08 am, Alexander Motin wrote:
> Jung-uk Kim wrote:
> > On Sunday 02 November 2008 07:50 am, Alexander Motin wrote:
> >> Author: mav
> >> Date: Sun Nov  2 12:50:16 2008
> >> New Revision: 184558
> >> URL: http://svn.freebsd.org/changeset/base/184558
> >>
> >> Log:
> >>   As soon as we have several threads per process now, it is not
> >> correct to use process ID as ACPI thread ID. Concurrent requests
> >> with equal thread IDs broke ACPI mutexes operation causing
> >> unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I
> >> have seen.
> >>
> >>   Use kernel thread ID instead of process ID for ACPI thread.
> >
> > Sorry but this patch is incorrect, i.e., td_tid is not unique. 
> > You have to use curthread or (p_pid, td_tid) pair. 
> > Unfortunately, even if you correct this problem, you also have to
> > correct ACPI_THREAD_ID definition, which is in the vendor code. 
> > That's why it wasn't done yet and it is more complicated than you
> > think, i.e., ACPI-CA assumes sizeof(ACPI_THREAD_ID) ==
> > sizeof(int), etc.  Please see the related ACPI-CA bugs:
>
> I'm also sorry, but that is what I see:
> typedef __int32_t       __lwpid_t;      /* Thread ID (a.k.a. LWP)
> */ ...
> td->td_tid = alloc_unr(tid_unrhdr);
> ...
> tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock);
>
> So what have I missed, where is the problem? Why td_tid is not
> unique and where is the size problem?

td_tid is unique for a process, i.e., it is used to identify thread 
with a same pid, if I am not totally mistaken.  If you want a true 
unique tid, you have to use struct thread *.

Jung-uk Kim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811031127.14928.jkim>