All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Will Deacon <will@kernel.org>
Cc: baolu.lu@linux.intel.com, Joerg Roedel <joro@8bytes.org>,
	Ashok Raj <ashok.raj@intel.com>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Guo Kaijie <Kaijie.Guo@intel.com>, Liu Yi L <yi.l.liu@intel.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev()
Date: Fri, 8 Jan 2021 22:30:14 +0800	[thread overview]
Message-ID: <72be0717-80ea-b0c3-9118-da8559158839@linux.intel.com> (raw)
In-Reply-To: <20210108140932.GA4811@willie-the-truck>

Hi Will,

On 2021/1/8 22:09, Will Deacon wrote:
> Hi Lu,
> 
> On Fri, Jan 08, 2021 at 07:52:47AM +0800, Lu Baolu wrote:
>> On 2021/1/6 9:09, Lu Baolu wrote:
>>> On 2021/1/6 3:03, Will Deacon wrote:
>>>> On Thu, Dec 31, 2020 at 08:53:20AM +0800, Lu Baolu wrote:
>>>>> @@ -170,6 +172,22 @@ static void intel_flush_svm_range_dev
>>>>> (struct intel_svm *svm, struct intel_svm_d
>>>>>        }
>>>>>    }
>>>>> +static void intel_flush_svm_range_dev(struct intel_svm *svm,
>>>>> +                      struct intel_svm_dev *sdev,
>>>>> +                      unsigned long address,
>>>>> +                      unsigned long pages, int ih)
>>>>> +{
>>>>> +    unsigned long shift = ilog2(__roundup_pow_of_two(pages));
>>>>> +    unsigned long align = (1ULL << (VTD_PAGE_SHIFT + shift));
>>>>> +    unsigned long start = ALIGN_DOWN(address, align);
>>>>> +    unsigned long end = ALIGN(address + (pages <<
>>>>> VTD_PAGE_SHIFT), align);
>>>>> +
>>>>> +    while (start < end) {
>>>>> +        __flush_svm_range_dev(svm, sdev, start, align >>
>>>>> VTD_PAGE_SHIFT, ih);
>>>>> +        start += align;
>>>>> +    }
>>>>> +}
>>>>
>>>> Given that this only seems to be called from
>>>> intel_invalidate_range(), which
>>>> has to compute 'pages' only to have it pulled apart again here,
>>>> perhaps it
>>>> would be cleaner for intel_flush_svm_range() to take something like an
>>>> 'order' argument instead?
>>>>
>>>> What do you think?
>>>
>>> We need to clean up here. It's duplicate with the qi_flush_piotlb()
>>> helper. I have a patch under testing for this. I will post it for review
>>> later.
>>
>> I'm sorry, above reply is a little vague.
>>
>> I meant to say, let's take 'pages' as the argument. We are going to use
>> qi_flush_piotlb() here to avoid duplicate QI interactions. The
>> qi_flush_piotlb() helper also takes 'pages', so keep 'pages' here will
>> make things easier.
>>
>> My cleanup patch is for v5.12. Can you please take this for v5.11?
> 
> Ah sorry, I didn't realise that was your plan. Please just include this
> patch in a series of 2 when you post a fixed version of the trace event
> removal and then I'll queue them up next week, as I've already prepared
> the pull for today.

Sure and sorry for my vague reply.

> 
> Apologies,

It's okay. :-)

> 
> Will
> 

Best regards,
baolu

WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Will Deacon <will@kernel.org>
Cc: Ashok Raj <ashok.raj@intel.com>,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	Guo Kaijie <Kaijie.Guo@intel.com>
Subject: Re: [PATCH 2/5] iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev()
Date: Fri, 8 Jan 2021 22:30:14 +0800	[thread overview]
Message-ID: <72be0717-80ea-b0c3-9118-da8559158839@linux.intel.com> (raw)
In-Reply-To: <20210108140932.GA4811@willie-the-truck>

Hi Will,

On 2021/1/8 22:09, Will Deacon wrote:
> Hi Lu,
> 
> On Fri, Jan 08, 2021 at 07:52:47AM +0800, Lu Baolu wrote:
>> On 2021/1/6 9:09, Lu Baolu wrote:
>>> On 2021/1/6 3:03, Will Deacon wrote:
>>>> On Thu, Dec 31, 2020 at 08:53:20AM +0800, Lu Baolu wrote:
>>>>> @@ -170,6 +172,22 @@ static void intel_flush_svm_range_dev
>>>>> (struct intel_svm *svm, struct intel_svm_d
>>>>>        }
>>>>>    }
>>>>> +static void intel_flush_svm_range_dev(struct intel_svm *svm,
>>>>> +                      struct intel_svm_dev *sdev,
>>>>> +                      unsigned long address,
>>>>> +                      unsigned long pages, int ih)
>>>>> +{
>>>>> +    unsigned long shift = ilog2(__roundup_pow_of_two(pages));
>>>>> +    unsigned long align = (1ULL << (VTD_PAGE_SHIFT + shift));
>>>>> +    unsigned long start = ALIGN_DOWN(address, align);
>>>>> +    unsigned long end = ALIGN(address + (pages <<
>>>>> VTD_PAGE_SHIFT), align);
>>>>> +
>>>>> +    while (start < end) {
>>>>> +        __flush_svm_range_dev(svm, sdev, start, align >>
>>>>> VTD_PAGE_SHIFT, ih);
>>>>> +        start += align;
>>>>> +    }
>>>>> +}
>>>>
>>>> Given that this only seems to be called from
>>>> intel_invalidate_range(), which
>>>> has to compute 'pages' only to have it pulled apart again here,
>>>> perhaps it
>>>> would be cleaner for intel_flush_svm_range() to take something like an
>>>> 'order' argument instead?
>>>>
>>>> What do you think?
>>>
>>> We need to clean up here. It's duplicate with the qi_flush_piotlb()
>>> helper. I have a patch under testing for this. I will post it for review
>>> later.
>>
>> I'm sorry, above reply is a little vague.
>>
>> I meant to say, let's take 'pages' as the argument. We are going to use
>> qi_flush_piotlb() here to avoid duplicate QI interactions. The
>> qi_flush_piotlb() helper also takes 'pages', so keep 'pages' here will
>> make things easier.
>>
>> My cleanup patch is for v5.12. Can you please take this for v5.11?
> 
> Ah sorry, I didn't realise that was your plan. Please just include this
> patch in a series of 2 when you post a fixed version of the trace event
> removal and then I'll queue them up next week, as I've already prepared
> the pull for today.

Sure and sorry for my vague reply.

> 
> Apologies,

It's okay. :-)

> 
> Will
> 

Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-01-08 14:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31  0:53 [PATCH 1/5] iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb() Lu Baolu
2020-12-31  0:53 ` Lu Baolu
2020-12-31  0:53 ` [PATCH 2/5] iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev() Lu Baolu
2020-12-31  0:53   ` Lu Baolu
2021-01-05 19:03   ` Will Deacon
2021-01-05 19:03     ` Will Deacon
2021-01-06  1:09     ` Lu Baolu
2021-01-06  1:09       ` Lu Baolu
2021-01-07 23:52       ` Lu Baolu
2021-01-07 23:52         ` Lu Baolu
2021-01-08 14:09         ` Will Deacon
2021-01-08 14:09           ` Will Deacon
2021-01-08 14:30           ` Lu Baolu [this message]
2021-01-08 14:30             ` Lu Baolu
2020-12-31  0:53 ` [PATCH 3/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu
2020-12-31  0:53   ` Lu Baolu
2021-01-05 19:04   ` Will Deacon
2021-01-05 19:04     ` Will Deacon
2021-01-06  1:14     ` Lu Baolu
2021-01-06  1:14       ` Lu Baolu
2021-01-07 14:40       ` Will Deacon
2021-01-07 14:40         ` Will Deacon
2021-01-08  0:00         ` Lu Baolu
2021-01-08  0:00           ` Lu Baolu
2020-12-31  0:53 ` [PATCH 4/5] Revert "iommu: Add quirk for Intel graphic devices in map_sg" Lu Baolu
2020-12-31  0:53   ` Lu Baolu
2020-12-31  0:53 ` [PATCH 5/5] iommu/vt-d: Fix lockdep splat in sva bind()/unbind() Lu Baolu
2020-12-31  0:53   ` Lu Baolu
2021-01-07 14:22 ` [PATCH 1/5] iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb() Will Deacon
2021-01-07 14:22   ` Will Deacon

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=72be0717-80ea-b0c3-9118-da8559158839@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=Kaijie.Guo@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.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 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.