All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: jglisse@redhat.com
Cc: "Ralph Campbell" <rcampbell@nvidia.com>,
	"Jan Kara" <jack@suse.cz>,
	kvm@vger.kernel.org, "Matthew Wilcox" <mawilcox@microsoft.com>,
	linux-rdma@vger.kernel.org, "John Hubbard" <jhubbard@nvidia.com>,
	"Felix Kuehling" <felix.kuehling@amd.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Michal Hocko" <mhocko@kernel.org>,
	linux-mm@kvack.org, "Christian Koenig" <christian.koenig@amd.com>,
	"Ross Zwisler" <zwisler@kernel.org>,
	linux-fsdevel@vger.kernel.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Dan Williams" <dan.j.williams@intel.com>
Subject: Re: [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls
Date: Wed, 5 Dec 2018 12:04:16 +0100	[thread overview]
Message-ID: <20181205110416.GE22304@quack2.suse.cz> (raw)
In-Reply-To: <20181203201817.10759-3-jglisse@redhat.com>

Hi Jerome!

On Mon 03-12-18 15:18:16, jglisse@redhat.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> To avoid having to change many call sites everytime we want to add a
> parameter use a structure to group all parameters for the mmu_notifier
> invalidate_range_start/end cakks. No functional changes with this
> patch.

Two suggestions for the patch below:

> @@ -772,7 +775,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index,
>  		 * call mmu_notifier_invalidate_range_start() on our behalf
>  		 * before taking any lock.
>  		 */
> -		if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
> +		if (follow_pte_pmd(vma->vm_mm, address, &range,
> +				   &ptep, &pmdp, &ptl))
>  			continue;

The change of follow_pte_pmd() arguments looks unexpected. Why should that
care about mmu notifier range? I see it may be convenient but it doesn't look
like a good API to me.

> @@ -1139,11 +1140,15 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
>  				downgrade_write(&mm->mmap_sem);
>  				break;
>  			}
> -			mmu_notifier_invalidate_range_start(mm, 0, -1);
> +
> +			range.start = 0;
> +			range.end = -1UL;
> +			range.mm = mm;
> +			mmu_notifier_invalidate_range_start(&range);

Also how about providing initializer for struct mmu_notifier_range? Or
something like DECLARE_MMU_NOTIFIER_RANGE? That will make sure that
unused arguments for particular notification places have defined values and
also if you add another mandatory argument (like you do in your third
patch), you just add another argument to the initializer and that way
the compiler makes sure you haven't missed any place. Finally the code will
remain more compact that way (less lines needed to initialize the struct).

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: jglisse@redhat.com
Cc: linux-mm@kvack.org, "Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"Matthew Wilcox" <mawilcox@microsoft.com>,
	"Ross Zwisler" <zwisler@kernel.org>, "Jan Kara" <jack@suse.cz>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Michal Hocko" <mhocko@kernel.org>,
	"Christian Koenig" <christian.koenig@amd.com>,
	"Felix Kuehling" <felix.kuehling@amd.com>,
	"Ralph Campbell" <rcampbell@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	kvm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-rdma@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls
Date: Wed, 5 Dec 2018 12:04:16 +0100	[thread overview]
Message-ID: <20181205110416.GE22304@quack2.suse.cz> (raw)
In-Reply-To: <20181203201817.10759-3-jglisse@redhat.com>

Hi Jerome!

On Mon 03-12-18 15:18:16, jglisse@redhat.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> To avoid having to change many call sites everytime we want to add a
> parameter use a structure to group all parameters for the mmu_notifier
> invalidate_range_start/end cakks. No functional changes with this
> patch.

Two suggestions for the patch below:

> @@ -772,7 +775,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index,
>  		 * call mmu_notifier_invalidate_range_start() on our behalf
>  		 * before taking any lock.
>  		 */
> -		if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
> +		if (follow_pte_pmd(vma->vm_mm, address, &range,
> +				   &ptep, &pmdp, &ptl))
>  			continue;

The change of follow_pte_pmd() arguments looks unexpected. Why should that
care about mmu notifier range? I see it may be convenient but it doesn't look
like a good API to me.

> @@ -1139,11 +1140,15 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
>  				downgrade_write(&mm->mmap_sem);
>  				break;
>  			}
> -			mmu_notifier_invalidate_range_start(mm, 0, -1);
> +
> +			range.start = 0;
> +			range.end = -1UL;
> +			range.mm = mm;
> +			mmu_notifier_invalidate_range_start(&range);

Also how about providing initializer for struct mmu_notifier_range? Or
something like DECLARE_MMU_NOTIFIER_RANGE? That will make sure that
unused arguments for particular notification places have defined values and
also if you add another mandatory argument (like you do in your third
patch), you just add another argument to the initializer and that way
the compiler makes sure you haven't missed any place. Finally the code will
remain more compact that way (less lines needed to initialize the struct).

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: jglisse@redhat.com
Cc: linux-mm@kvack.org, "Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"Matthew Wilcox" <mawilcox@microsoft.com>,
	"Ross Zwisler" <zwisler@kernel.org>, "Jan Kara" <jack@suse.cz>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Michal Hocko" <mhocko@kernel.org>,
	"Christian Koenig" <christian.koenig@amd.com>,
	"Felix Kuehling" <felix.kuehling@amd.com>,
	"Ralph Campbell" <rcampbell@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	kvm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-rdma@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls
Date: Wed, 5 Dec 2018 12:04:16 +0100	[thread overview]
Message-ID: <20181205110416.GE22304@quack2.suse.cz> (raw)
In-Reply-To: <20181203201817.10759-3-jglisse@redhat.com>

Hi Jerome!

On Mon 03-12-18 15:18:16, jglisse@redhat.com wrote:
> From: J�r�me Glisse <jglisse@redhat.com>
> 
> To avoid having to change many call sites everytime we want to add a
> parameter use a structure to group all parameters for the mmu_notifier
> invalidate_range_start/end cakks. No functional changes with this
> patch.

Two suggestions for the patch below:

> @@ -772,7 +775,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index,
>  		 * call mmu_notifier_invalidate_range_start() on our behalf
>  		 * before taking any lock.
>  		 */
> -		if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
> +		if (follow_pte_pmd(vma->vm_mm, address, &range,
> +				   &ptep, &pmdp, &ptl))
>  			continue;

The change of follow_pte_pmd() arguments looks unexpected. Why should that
care about mmu notifier range? I see it may be convenient but it doesn't look
like a good API to me.

> @@ -1139,11 +1140,15 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
>  				downgrade_write(&mm->mmap_sem);
>  				break;
>  			}
> -			mmu_notifier_invalidate_range_start(mm, 0, -1);
> +
> +			range.start = 0;
> +			range.end = -1UL;
> +			range.mm = mm;
> +			mmu_notifier_invalidate_range_start(&range);

Also how about providing initializer for struct mmu_notifier_range? Or
something like DECLARE_MMU_NOTIFIER_RANGE? That will make sure that
unused arguments for particular notification places have defined values and
also if you add another mandatory argument (like you do in your third
patch), you just add another argument to the initializer and that way
the compiler makes sure you haven't missed any place. Finally the code will
remain more compact that way (less lines needed to initialize the struct).

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  parent reply	other threads:[~2018-12-05 11:04 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 20:18 [PATCH 0/3] mmu notifier contextual informations jglisse
2018-12-03 20:18 ` jglisse
2018-12-03 20:18 ` [PATCH 1/3] mm/mmu_notifier: use structure for invalidate_range_start/end callback jglisse
2018-12-03 20:18 ` [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls jglisse
2018-12-03 20:18   ` jglisse
2018-12-04  0:09   ` Jerome Glisse
2018-12-04  0:09     ` Jerome Glisse
2018-12-05 11:04   ` Jan Kara [this message]
2018-12-05 11:04     ` Jan Kara
2018-12-05 11:04     ` Jan Kara
2018-12-05 15:53     ` Jerome Glisse
2018-12-05 15:53       ` Jerome Glisse
2018-12-05 16:28       ` Jan Kara
2018-12-05 16:28         ` Jan Kara
2018-12-05 16:28         ` Jan Kara
2018-12-06 20:31   ` kbuild test robot
2018-12-06 20:31     ` kbuild test robot
2018-12-06 20:31     ` kbuild test robot
2018-12-06 20:31     ` kbuild test robot
2018-12-06 20:31     ` kbuild test robot
2018-12-06 20:35   ` kbuild test robot
2018-12-06 20:35     ` kbuild test robot
2018-12-06 20:35     ` kbuild test robot
2018-12-06 20:35     ` kbuild test robot
2018-12-03 20:18 ` [PATCH 3/3] mm/mmu_notifier: contextual information for event triggering invalidation jglisse
2018-12-04  8:17   ` Mike Rapoport
2018-12-04 14:48     ` Jerome Glisse
2018-12-04 14:48       ` Jerome Glisse
2018-12-04 23:21   ` Andrew Morton
2018-12-06 20:53   ` kbuild test robot
2018-12-06 20:53     ` kbuild test robot
2018-12-06 20:53     ` kbuild test robot
2018-12-06 20:53     ` kbuild test robot
2018-12-06 20:53     ` kbuild test robot
2018-12-06 21:19   ` kbuild test robot
2018-12-06 21:19     ` kbuild test robot
2018-12-06 21:19     ` kbuild test robot
2018-12-06 21:19     ` kbuild test robot
2018-12-06 21:19     ` kbuild test robot
2018-12-06 21:51     ` Jerome Glisse
2018-12-06 21:51       ` Jerome Glisse
2018-12-06 21:51       ` Jerome Glisse
2018-12-06 21:51       ` Jerome Glisse
2018-12-04  7:35 ` [PATCH 0/3] mmu notifier contextual informations Koenig, Christian
2018-12-04  7:35   ` Koenig, Christian

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=20181205110416.GE22304@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mawilcox@microsoft.com \
    --cc=mhocko@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rcampbell@nvidia.com \
    --cc=rkrcmar@redhat.com \
    --cc=zwisler@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 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.