mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Chris Leech <christopher.leech@intel.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 3/8] [I/OAT] Setup the networking subsystem as a DMA client
Date: Sat, 11 Mar 2006 00:56:19 -0800	[thread overview]
Message-ID: <20060311005619.70dad219.akpm@osdl.org> (raw)
In-Reply-To: <20060311022924.3950.33580.stgit@gitlost.site>

Chris Leech <christopher.leech@intel.com> wrote:
>

There seems to be a small race here.

> +static void net_dma_rebalance(void)
>  +{
>  +	unsigned int cpu, i, n;
>  +	struct dma_chan *chan;
>  +
>  +	lock_cpu_hotplug();
>  +
>  +	if (net_dma_count == 0) {
>  +		for_each_online_cpu(cpu)
>  +			rcu_assign_pointer(per_cpu(softnet_data.net_dma, cpu), NULL);
>  +		unlock_cpu_hotplug();
>  +		return;
>  +	}

If some other CPU does netdev_dma_event(DMA_RESOURCE_REMOVED) now

>  +	i = 0;
>  +	cpu = first_cpu(cpu_online_map);
>  +
>  +	rcu_read_lock();
>  +	list_for_each_entry(chan, &net_dma_client->channels, client_node) {
>  +		n = ((num_online_cpus() / net_dma_count)
>  +		   + (i < (num_online_cpus() % net_dma_count) ? 1 : 0));

This will get a divide-by-zero.

>  +		while(n) {
>  +			per_cpu(softnet_data.net_dma, cpu) = chan;
>  +			cpu = next_cpu(cpu, cpu_online_map);
>  +			n--;
>  +		}
>  +		i++;
>  +	}
>  +	rcu_read_unlock();
>  +
>  +	unlock_cpu_hotplug();
>  +}
>  +
>  +/**
>  + * netdev_dma_event - event callback for the net_dma_client
>  + * @client: should always be net_dma_client
>  + * @chan:
>  + * @event:
>  + */
>  +static void netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
>  +	enum dma_event event)
>  +{
>  +	switch (event) {
>  +	case DMA_RESOURCE_ADDED:
>  +		net_dma_count++;
>  +		net_dma_rebalance();
>  +		break;
>  +	case DMA_RESOURCE_REMOVED:
>  +		net_dma_count--;
>  +		net_dma_rebalance();
>  +		break;
>  +	default:
>  +		break;
>  +	}
>  +}

  reply	other threads:[~2006-03-11  8:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-11  2:27 [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT) Chris Leech
2006-03-11  2:29 ` [PATCH 1/8] [I/OAT] DMA memcpy subsystem Chris Leech
2006-03-11  8:53   ` Andrew Morton
2006-03-14 22:13   ` Pavel Machek
2006-03-17  7:30   ` Kumar Gala
2006-03-28 18:44     ` Andrew Grover
2006-03-28 18:58       ` Kumar Gala
2006-03-28 22:01         ` Andrew Grover
2006-03-28 23:03           ` Kumar Gala
2006-03-29 23:05             ` Andrew Grover
2006-03-30  8:01               ` Kumar Gala
2006-03-30 18:27                 ` Andrew Grover
2006-03-11  2:29 ` [PATCH 3/8] [I/OAT] Setup the networking subsystem as a DMA client Chris Leech
2006-03-11  8:56   ` Andrew Morton [this message]
2006-03-11  9:00   ` Andrew Morton
2006-03-11  2:29 ` [PATCH 4/8] [I/OAT] Utility functions for offloading sk_buff to iovec copies Chris Leech
2006-03-11  2:29 ` [PATCH 5/8] [I/OAT] Structure changes for TCP recv offload to I/OAT Chris Leech
2006-03-11  2:29 ` [PATCH 6/8] [I/OAT] Rename cleanup_rbuf to tcp_cleanup_rbuf and make non-static Chris Leech
2006-03-11  2:29 ` [PATCH 7/8] [I/OAT] Add a sysctl for tuning the I/OAT offloaded I/O threshold Chris Leech
2006-03-11  2:29 ` [PATCH 8/8] [I/OAT] TCP recv offload to I/OAT Chris Leech
2006-03-11  9:41   ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2006-03-13 22:12 [PATCH 3/8] [I/OAT] Setup the networking subsystem as a DMA client Leech, Christopher
2006-03-03 21:40 [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT) Chris Leech
2006-03-03 21:42 ` [PATCH 3/8] [I/OAT] Setup the networking subsystem as a DMA client Chris Leech

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=20060311005619.70dad219.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=christopher.leech@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®