From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-kernel@vger.kernel.org, jeffrey.t.kirsher@intel.com
Subject: Re: [PATCH 11/17] fuse: add number of waiting requests attribute
Date: Wed, 18 Jan 2006 06:56:34 +0100 [thread overview]
Message-ID: <43CDD892.6090605@cosmosbay.com> (raw)
In-Reply-To: <20060113172846.3ea49670.akpm@osdl.org>
Andrew Morton a écrit :
> Miklos Szeredi <miklos@szeredi.hu> wrote:
>> + /** The number of requests waiting for completion */
>> + atomic_t num_waiting;
>
> This doesn't get initialised anywhere.
>
> Presumably you're relying on a memset somewhere. That might work on all
> architectures, AFAIK. But in theory it's wrong. If, for example, the
> architecture implements atomic_t via a spinlock-plus-integer, and that
> spinlock's unlocked state is not all-bits-zero, we're dead.
>
> So we should initialise it with
>
> foo->num_waiting = ATOMIC_INIT(0);
>
>
>
> nb: it is not correct to initialise an atomic_t with
>
> atomic_set(a, 0);
>
> because in the above theoretical case case where the arch uses a spinlock
> in the atomic_t, that spinlock doesn't get initialised. I bet we've got code
> in there which does this.
Hum... I tracked one missing atomic_set() or ATOMIC_INIT in e1000 driver then.
e1000_alloc_queues() does :
#ifdef CONFIG_E1000_NAPI
size = sizeof(struct net_device) * adapter->num_queues;
adapter->polling_netdev = kmalloc(size, GFP_KERNEL);
if (!adapter->polling_netdev) {
kfree(adapter->tx_ring);
kfree(adapter->rx_ring);
return -ENOMEM;
}
memset(adapter->polling_netdev, 0, size);
#endif
So this driver clearly assumes a memset(... 0 ...) also initialize atomic_t to
0 ((struct net_device *)->refcnt for example)
Eric
next prev parent reply other threads:[~2006-01-18 5:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-14 0:39 [PATCH 00/17] fuse: fixes, cleanups and asynchronous read requests Miklos Szeredi
2006-01-14 0:39 ` [PATCH 01/17] add /sys/fs Miklos Szeredi
2006-01-17 12:47 ` Christoph Hellwig
2006-01-17 12:52 ` Miklos Szeredi
2006-01-14 0:39 ` [PATCH 02/17] fuse: fuse_copy_finish() order fix Miklos Szeredi
2006-01-14 0:39 ` [PATCH 03/17] fuse: fix request_end() Miklos Szeredi
2006-01-14 0:39 ` [PATCH 04/17] fuse: handle error INIT reply Miklos Szeredi
2006-01-14 0:39 ` [PATCH 05/17] fuse: uninline some functions Miklos Szeredi
2006-01-14 0:39 ` [PATCH 06/17] fuse: miscellaneous cleanup Miklos Szeredi
2006-01-14 0:39 ` [PATCH 07/17] fuse: introduce unified request state Miklos Szeredi
2006-01-14 0:39 ` [PATCH 08/17] fuse: introduce list for requests under I/O Miklos Szeredi
2006-01-14 0:39 ` [PATCH 09/17] fuse: extend semantics of connected flag Miklos Szeredi
2006-01-14 0:39 ` [PATCH 10/17] fuse: make fuse connection a kobject Miklos Szeredi
2006-01-14 0:39 ` [PATCH 11/17] fuse: add number of waiting requests attribute Miklos Szeredi
2006-01-14 1:28 ` Andrew Morton
2006-01-14 9:44 ` Miklos Szeredi
2006-01-14 9:53 ` Andrew Morton
2006-01-18 5:56 ` Eric Dumazet [this message]
2006-01-14 0:40 ` [PATCH 12/17] fuse: add connection aborting Miklos Szeredi
2006-01-14 1:31 ` Andrew Morton
2006-01-14 9:50 ` Miklos Szeredi
2006-01-14 0:40 ` [PATCH 13/17] fuse: add asynchronous request support Miklos Szeredi
2006-01-14 0:40 ` [PATCH 14/17] fuse: move INIT handling to inode.c Miklos Szeredi
2006-01-14 0:40 ` [PATCH 15/17] fuse: READ request initialization Miklos Szeredi
2006-01-14 0:40 ` [PATCH 16/17] fuse: use asynchronous READ requests for readpages Miklos Szeredi
2006-01-14 0:40 ` [PATCH 17/17] fuse: update documentation for sysfs Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43CDD892.6090605@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.