Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Gary R Hook <ghook@amd.com>, Gary R Hook <gary.hook@amd.com>,
	linux-ntb@googlegroups.com
Subject: Re: [PATCH V2 1/3] ntb: Add a module option to control affinity of DMA channels
Date: Thu, 4 May 2017 14:03:38 -0700	[thread overview]
Message-ID: <c209a641-040b-a216-23da-a34490a91f1d@intel.com> (raw)
In-Reply-To: <3e79fa1f-c29b-0f8b-4a3d-9591d5a89a18@amd.com>



On 05/04/2017 02:00 PM, Gary R Hook wrote:
> On 05/04/2017 03:52 PM, Gary R Hook wrote:
>> On 05/04/2017 03:28 PM, Dave Jiang wrote:
>>>
>>>
>>> On 05/04/2017 01:21 PM, Gary R Hook wrote:
>>>> The DMA channel(s)/memory used to transfer data to an NTB device
>>>> may not be required to be on the same node as the device. Add a
>>>> module parameter that allows any candidate channel (aside from
>>>> node assocation) and allocated memory to be used.
>>>>
>>>> Signed-off-by: Gary R Hook <gary.hook@amd.com>
>>>> ---
>>>>  drivers/ntb/test/ntb_perf.c |   16 ++++++++++++++--
>>>>  1 file changed, 14 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
>>>> index 42756a98a728..bfceae0e6477 100644
>>>> --- a/drivers/ntb/test/ntb_perf.c
>>>> +++ b/drivers/ntb/test/ntb_perf.c
>>>> @@ -101,6 +101,10 @@
>>>>  module_param(use_dma, bool, 0644);
>>>>  MODULE_PARM_DESC(use_dma, "Using DMA engine to measure performance");
>>>>
>>>> +static bool on_node = true; /* default to 1 */
>>>> +module_param(on_node, bool, 0644);
>>>> +MODULE_PARM_DESC(on_node, "Run threads only on NTB device node
>>>> (default: true)");
>>>> +
>>>>  struct perf_mw {
>>>>      phys_addr_t    phys_addr;
>>>>      resource_size_t    phys_size;
>>>> @@ -345,6 +349,10 @@ static int perf_move_data(struct pthr_ctx *pctx,
>>>> char __iomem *dst, char *src,
>>>>
>>>>  static bool perf_dma_filter_fn(struct dma_chan *chan, void *node)
>>>>  {
>>>> +    /* Is the channel required to be on the same node as the
>>>> device? */
>>>> +    if (!on_node)
>>>> +        return true;
>>>> +
>>>>      return dev_to_node(&chan->dev->device) == (int)(unsigned
>>>> long)node;
>>>>  }
>>>>
>>>> @@ -682,7 +690,8 @@ static ssize_t debugfs_run_write(struct file
>>>> *filp, const char __user *ubuf,
>>>>          pr_info("Fix run_order to %u\n", run_order);
>>>>      }
>>>>
>>>> -    node = dev_to_node(&perf->ntb->pdev->dev);
>>>> +    node = on_node ? dev_to_node(&perf->ntb->pdev->dev)
>>>> +               : NUMA_NO_NODE;
>>>>      atomic_set(&perf->tdone, 0);
>>>>
>>>>      /* launch kernel thread */
>>>> @@ -781,7 +790,10 @@ static int perf_probe(struct ntb_client *client,
>>>> struct ntb_dev *ntb)
>>>>
>>>>      node = dev_to_node(&pdev->dev);
>>>>
>>>> -    perf = kzalloc_node(sizeof(*perf), GFP_KERNEL, node);
>>>> +    if (on_node)
>>>> +        perf = kzalloc_node(sizeof(*perf), GFP_KERNEL, node);
>>>> +    else
>>>> +        perf = kzalloc(sizeof(*perf), GFP_KERNEL);
>>>
>>> Is this necessary when NUMA_NO_NODE is passed in?
>>
>> Excellent question. I traced kzalloc_node down to slab_alloc_node(), and
>> it does
>> indeed check (parameter) nodeid against NUMA_NO_NODE. So that would be
>> an option
>> for the node variable above.
>>
>> However, since the code above, as written, doesn't allow for
>> NUMA_NO_NODE, some
>> additional work will be required to properly handle the option. Look for
>> a V3 of
>> this series.
> 
> Actually, I think this engenders some further consideration. The buffer
> allocation code around line 390 also wants to be node-aware. Would it
> make sense to have a switch the completely ignores any NUMA concerns for
> threads and memory? A switch for threads, and a switch for memory? There
> are a number of combinations that may be of interest here, but I'm not
> sure how far I want to/should go at this point. Maybe just a single
> comprehensive switch to turn node-sensitivity on/off (i.e. have on_node
> cover all the bases)?
> 

That's probably ok if we want to just ignore all NUMA awareness for
testing.

  reply	other threads:[~2017-05-04 21:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04 20:21 [PATCH V2 0/3] Add/expose control features for the NTB perf test module Gary R Hook
2017-05-04 20:21 ` [PATCH V2 1/3] ntb: Add a module option to control affinity of DMA channels Gary R Hook
2017-05-04 20:28   ` Dave Jiang
2017-05-04 20:52     ` Gary R Hook
2017-05-04 21:00       ` Gary R Hook
2017-05-04 21:03         ` Dave Jiang [this message]
2017-05-04 23:11           ` Gary R Hook
2017-05-04 20:21 ` [PATCH V2 2/3] ntb: Remove debug-fs variables from the context structure Gary R Hook
2017-05-04 20:21 ` [PATCH V2 3/3] ntb: Add more debugfs support for ntb_perf testing options Gary R Hook

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=c209a641-040b-a216-23da-a34490a91f1d@intel.com \
    --to=dave.jiang@intel.com \
    --cc=gary.hook@amd.com \
    --cc=ghook@amd.com \
    --cc=linux-ntb@googlegroups.com \
    /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