<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/linux/klist.h, branch Colibri_T30_LinuxImageV2.1Beta2_20140206</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>klist: Fix object alignment on 64-bit.</title>
<updated>2011-02-14T00:54:24+00:00</updated>
<author>
<name>David Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2011-02-14T00:37:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=795abaf1e4e188c4171e3cd3dbb11a9fcacaf505'/>
<id>795abaf1e4e188c4171e3cd3dbb11a9fcacaf505</id>
<content type='text'>
Commit c0e69a5bbc6f ("klist.c: bit 0 in pointer can't be used as flag")
intended to make sure that all klist objects were at least pointer size
aligned, but used the constant "4" which only works on 32-bit.

Use "sizeof(void *)" which is correct in all cases.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Acked-by: Jesper Nilsson &lt;jesper.nilsson@axis.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit c0e69a5bbc6f ("klist.c: bit 0 in pointer can't be used as flag")
intended to make sure that all klist objects were at least pointer size
aligned, but used the constant "4" which only works on 32-bit.

Use "sizeof(void *)" which is correct in all cases.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Acked-by: Jesper Nilsson &lt;jesper.nilsson@axis.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>klist.c: bit 0 in pointer can't be used as flag</title>
<updated>2009-01-21T04:52:10+00:00</updated>
<author>
<name>Jesper Nilsson</name>
<email>Jesper.Nilsson@axis.com</email>
</author>
<published>2009-01-14T10:19:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c0e69a5bbc6fc74184aa043aadb9a53bc58f953b'/>
<id>c0e69a5bbc6fc74184aa043aadb9a53bc58f953b</id>
<content type='text'>
The commit a1ed5b0cffe4b16a93a6a3390e8cee0fbef94f86
(klist: don't iterate over deleted entries) introduces use of the
low bit in a pointer to indicate if the knode is dead or not,
assuming that this bit is always free.

This is not true for all architectures, CRIS for example may align data
on byte borders.

The result is a bunch of warnings on bootup, devices not being
added correctly etc, reported by Hinko Kocevar &lt;hinko.kocevar@cetrtapot.si&gt;:

------------[ cut here ]------------
WARNING: at lib/klist.c:62 ()
Modules linked in:

Stack from c1fe1cf0:
       c01cc7f4 c1fe1d11 c000eb4e c000e4de 00000000 00000000 c1f4f78f c1f50c2d
       c01d008c c1fdd1a0 c1fdd1a0 c1fe1d38 c0192954 c1fe0000 00000000 c1fe1dc0
       00000002 7fffffff c1fe1da8 c0192d50 c1fe1dc0 00000002 7fffffff c1ff9fcc
Call Trace: [&lt;c000eb4e&gt;] [&lt;c000e4de&gt;] [&lt;c0192954&gt;] [&lt;c0192d50&gt;] [&lt;c001d49e&gt;] [&lt;c000b688&gt;] [&lt;c0192a3c&gt;]
       [&lt;c000b63e&gt;] [&lt;c000b63e&gt;] [&lt;c001a542&gt;] [&lt;c00b55b0&gt;] [&lt;c00411c0&gt;] [&lt;c00b559c&gt;] [&lt;c01918e6&gt;] [&lt;c0191988&gt;]
       [&lt;c01919d0&gt;] [&lt;c00cd9c8&gt;] [&lt;c00cdd6a&gt;] [&lt;c0034178&gt;] [&lt;c000409a&gt;] [&lt;c0015576&gt;] [&lt;c0029130&gt;] [&lt;c0029078&gt;]
       [&lt;c0029170&gt;] [&lt;c0012336&gt;] [&lt;c00b4076&gt;] [&lt;c00b4770&gt;] [&lt;c006d6e4&gt;] [&lt;c006d974&gt;] [&lt;c006dca0&gt;] [&lt;c0028d6c&gt;]
       [&lt;c0028e12&gt;] [&lt;c0006424&gt;] &lt;4&gt;---[ end trace 4eaa2a86a8e2da22 ]---
------------[ cut here ]------------
Repeat ad nauseam.

Wed, Jan 14, 2009 at 12:11:32AM +0100, Bastien ROUCARIES wrote:
&gt; Perhaps using a pointerhackalign trick on this structure where
&gt; #define pointerhackalign(x) __attribute__ ((aligned (x)))
&gt; and declare
&gt; struct klist_node {
&gt; ...
&gt; }  pointerhackalign(2);
&gt;
&gt; Because  __attribute__ ((aligned (x))) could only increase alignment
&gt; it will safe to do that and serve as documentation purpose :)

That works, but we need to do it not for the struct klist_node,
but for the struct we insert into the void * in klist_node,
which is struct klist.

Reported-by: Hinko Kocevar &lt;hinko.kocevar@cetrtapot.si
Cc: Bastien ROUCARIES &lt;roucaries.bastien@gmail.com&gt;
Signed-off-by: Jesper Nilsson &lt;jesper.nilsson@axis.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The commit a1ed5b0cffe4b16a93a6a3390e8cee0fbef94f86
(klist: don't iterate over deleted entries) introduces use of the
low bit in a pointer to indicate if the knode is dead or not,
assuming that this bit is always free.

This is not true for all architectures, CRIS for example may align data
on byte borders.

The result is a bunch of warnings on bootup, devices not being
added correctly etc, reported by Hinko Kocevar &lt;hinko.kocevar@cetrtapot.si&gt;:

------------[ cut here ]------------
WARNING: at lib/klist.c:62 ()
Modules linked in:

Stack from c1fe1cf0:
       c01cc7f4 c1fe1d11 c000eb4e c000e4de 00000000 00000000 c1f4f78f c1f50c2d
       c01d008c c1fdd1a0 c1fdd1a0 c1fe1d38 c0192954 c1fe0000 00000000 c1fe1dc0
       00000002 7fffffff c1fe1da8 c0192d50 c1fe1dc0 00000002 7fffffff c1ff9fcc
Call Trace: [&lt;c000eb4e&gt;] [&lt;c000e4de&gt;] [&lt;c0192954&gt;] [&lt;c0192d50&gt;] [&lt;c001d49e&gt;] [&lt;c000b688&gt;] [&lt;c0192a3c&gt;]
       [&lt;c000b63e&gt;] [&lt;c000b63e&gt;] [&lt;c001a542&gt;] [&lt;c00b55b0&gt;] [&lt;c00411c0&gt;] [&lt;c00b559c&gt;] [&lt;c01918e6&gt;] [&lt;c0191988&gt;]
       [&lt;c01919d0&gt;] [&lt;c00cd9c8&gt;] [&lt;c00cdd6a&gt;] [&lt;c0034178&gt;] [&lt;c000409a&gt;] [&lt;c0015576&gt;] [&lt;c0029130&gt;] [&lt;c0029078&gt;]
       [&lt;c0029170&gt;] [&lt;c0012336&gt;] [&lt;c00b4076&gt;] [&lt;c00b4770&gt;] [&lt;c006d6e4&gt;] [&lt;c006d974&gt;] [&lt;c006dca0&gt;] [&lt;c0028d6c&gt;]
       [&lt;c0028e12&gt;] [&lt;c0006424&gt;] &lt;4&gt;---[ end trace 4eaa2a86a8e2da22 ]---
------------[ cut here ]------------
Repeat ad nauseam.

Wed, Jan 14, 2009 at 12:11:32AM +0100, Bastien ROUCARIES wrote:
&gt; Perhaps using a pointerhackalign trick on this structure where
&gt; #define pointerhackalign(x) __attribute__ ((aligned (x)))
&gt; and declare
&gt; struct klist_node {
&gt; ...
&gt; }  pointerhackalign(2);
&gt;
&gt; Because  __attribute__ ((aligned (x))) could only increase alignment
&gt; it will safe to do that and serve as documentation purpose :)

That works, but we need to do it not for the struct klist_node,
but for the struct we insert into the void * in klist_node,
which is struct klist.

Reported-by: Hinko Kocevar &lt;hinko.kocevar@cetrtapot.si
Cc: Bastien ROUCARIES &lt;roucaries.bastien@gmail.com&gt;
Signed-off-by: Jesper Nilsson &lt;jesper.nilsson@axis.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>driver core: Remove completion from struct klist_node</title>
<updated>2009-01-06T18:44:30+00:00</updated>
<author>
<name>Matthew Wilcox</name>
<email>matthew@wil.cx</email>
</author>
<published>2008-10-16T20:57:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=210272a28465a7a31bcd580d2f9529f924965aa5'/>
<id>210272a28465a7a31bcd580d2f9529f924965aa5</id>
<content type='text'>
Removing the completion from klist_node reduces its size from 64 bytes
to 28 on x86-64.  To maintain the semantics of klist_remove(), we add
a single list of klist nodes which are pending deletion and scan them.

Signed-off-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Removing the completion from klist_node reduces its size from 64 bytes
to 28 on x86-64.  To maintain the semantics of klist_remove(), we add
a single list of klist nodes which are pending deletion and scan them.

Signed-off-by: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>klist: don't iterate over deleted entries</title>
<updated>2008-10-09T06:56:04+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2008-08-25T17:50:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a1ed5b0cffe4b16a93a6a3390e8cee0fbef94f86'/>
<id>a1ed5b0cffe4b16a93a6a3390e8cee0fbef94f86</id>
<content type='text'>
A klist entry is kept on the list till all its current iterations are
finished; however, a new iteration after deletion also iterates over
deleted entries as long as their reference count stays above zero.
This causes problems for cases where there are users which iterate
over the list while synchronized against list manipulations and
natuarally expect already deleted entries to not show up during
iteration.

This patch implements dead flag which gets set on deletion so that
iteration can skip already deleted entries.  The dead flag piggy backs
on the lowest bit of knode-&gt;n_klist and only visible to klist
implementation proper.

While at it, drop klist_iter-&gt;i_head as it's redundant and doesn't
offer anything in semantics or performance wise as klist_iter-&gt;i_klist
is dereferenced on every iteration anyway.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A klist entry is kept on the list till all its current iterations are
finished; however, a new iteration after deletion also iterates over
deleted entries as long as their reference count stays above zero.
This causes problems for cases where there are users which iterate
over the list while synchronized against list manipulations and
natuarally expect already deleted entries to not show up during
iteration.

This patch implements dead flag which gets set on deletion so that
iteration can skip already deleted entries.  The dead flag piggy backs
on the lowest bit of knode-&gt;n_klist and only visible to klist
implementation proper.

While at it, drop klist_iter-&gt;i_head as it's redundant and doesn't
offer anything in semantics or performance wise as klist_iter-&gt;i_klist
is dereferenced on every iteration anyway.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>klist: fix coding style errors in klist.h and klist.c</title>
<updated>2008-04-30T23:52:58+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@suse.de</email>
</author>
<published>2008-04-30T23:43:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c3bb7fadaf52de3637b834002dac27f6250b4b49'/>
<id>c3bb7fadaf52de3637b834002dac27f6250b4b49</id>
<content type='text'>
Finally clean up the odd spacing in these files.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Finally clean up the odd spacing in these files.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>klist: implement klist_add_{after|before}()</title>
<updated>2008-04-30T23:52:47+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>htejun@gmail.com</email>
</author>
<published>2008-04-22T09:58:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=93dd40013f4f7f4b18d19d0d77855f025bcc57c3'/>
<id>93dd40013f4f7f4b18d19d0d77855f025bcc57c3</id>
<content type='text'>
Add klist_add_after() and klist_add_before() which puts a new node
after and before an existing node, respectively.  This is useful for
callers which need to keep klist ordered.  Note that synchronizing
between simultaneous additions for ordering is the caller's
responsibility.

Signed-off-by: Tejun Heo &lt;htejun@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add klist_add_after() and klist_add_before() which puts a new node
after and before an existing node, respectively.  This is useful for
callers which need to keep klist ordered.  Note that synchronizing
between simultaneous additions for ordering is the caller's
responsibility.

Signed-off-by: Tejun Heo &lt;htejun@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>klist: implement KLIST_INIT() and DEFINE_KLIST()</title>
<updated>2008-04-30T23:52:47+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>htejun@gmail.com</email>
</author>
<published>2008-04-25T18:16:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1da43e4a9ee942c9c967dbe8839476571df0c3ed'/>
<id>1da43e4a9ee942c9c967dbe8839476571df0c3ed</id>
<content type='text'>
klist is missing static initializers and definition helper.  Add them.

Signed-off-by: Tejun Heo &lt;htejun@gmail.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
klist is missing static initializers and definition helper.  Add them.

Signed-off-by: Tejun Heo &lt;htejun@gmail.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] fix klist semantics for lists which have elements removed on traversal</title>
<updated>2005-09-08T01:26:54+00:00</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@HansenPartnership.com</email>
</author>
<published>2005-09-06T23:56:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=34bb61f9ddabd7a7f909cbfb05592eb775f6662a'/>
<id>34bb61f9ddabd7a7f909cbfb05592eb775f6662a</id>
<content type='text'>
The problem is that klists claim to provide semantics for safe traversal of
lists which are being modified.  The failure case is when traversal of a
list causes element removal (a fairly common case).  The issue is that
although the list node is refcounted, if it is embedded in an object (which
is universally the case), then the object will be freed regardless of the
klist refcount leading to slab corruption because the klist iterator refers
to the prior element to get the next.

The solution is to make the klist take and release references to the
embedding object meaning that the embedding object won't be released until
the list relinquishes the reference to it.

(akpm: fast-track this because it's needed for the 2.6.13 scsi merge)

Signed-off-by: James Bottomley &lt;James.Bottomley@SteelEye.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The problem is that klists claim to provide semantics for safe traversal of
lists which are being modified.  The failure case is when traversal of a
list causes element removal (a fairly common case).  The issue is that
although the list node is refcounted, if it is embedded in an object (which
is universally the case), then the object will be freed regardless of the
klist refcount leading to slab corruption because the klist iterator refers
to the prior element to get the next.

The solution is to make the klist take and release references to the
embedding object meaning that the embedding object won't be released until
the list relinquishes the reference to it.

(akpm: fast-track this because it's needed for the 2.6.13 scsi merge)

Signed-off-by: James Bottomley &lt;James.Bottomley@SteelEye.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] klist: fix klist to have the same klist_add semantics as list_head</title>
<updated>2005-09-05T23:03:13+00:00</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@SteelEye.com</email>
</author>
<published>2005-08-19T13:14:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d856f1e337782326c638c70c0b4df2b909350dec'/>
<id>d856f1e337782326c638c70c0b4df2b909350dec</id>
<content type='text'>
at the moment, the list_head semantics are

list_add(node, head)

whereas current klist semantics are

klist_add(head, node)

This is bound to cause confusion, and since klist is the newcomer, it
should follow the list_head semantics.

I also added missing include guards to klist.h

Signed-off-by: James Bottomley &lt;James.Bottomley@SteelEye.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
at the moment, the list_head semantics are

list_add(node, head)

whereas current klist semantics are

klist_add(head, node)

This is bound to cause confusion, and since klist is the newcomer, it
should follow the list_head semantics.

I also added missing include guards to klist.h

Signed-off-by: James Bottomley &lt;James.Bottomley@SteelEye.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[PATCH] add klist_node_attached() to determine if a node is on a list or not.</title>
<updated>2005-06-20T22:15:17+00:00</updated>
<author>
<name>mochel@digitalimplant.org</name>
<email>mochel@digitalimplant.org</email>
</author>
<published>2005-03-24T20:58:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8b0c250be489dcbf1a3a33bb4ec4c7f33735a365'/>
<id>8b0c250be489dcbf1a3a33bb4ec4c7f33735a365</id>
<content type='text'>
Signed-off-by: Patrick Mochel &lt;mochel@digitalimplant.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

diff -Nru a/include/linux/klist.h b/include/linux/klist.h
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Patrick Mochel &lt;mochel@digitalimplant.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

diff -Nru a/include/linux/klist.h b/include/linux/klist.h
</pre>
</div>
</content>
</entry>
</feed>
