Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1448895
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Nicholas Piggin <npiggin@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [kernel,v2,1/2] powerpc/iommu: Stop using @current in mm_iommu_xxx |
| Date | Sat, 23 Jul 2016 08:40:02 +0200 |
| Message-ID | <rXYLo-7WF-29@gated-at.bofh.it> (permalink) |
| References | <rWRsC-55G-19@gated-at.bofh.it> |
| X-Original-To | Alexey Kardashevskiy <aik@ozlabs.ru> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=ox4GXp8Bz3mHfw0xot9mGE0njujNiZsBLZN40TD5Mk4=; b=yHA1Fl+kCy8gMv3OoYYj5uU0AiXw2wU0QjHoFgKj4ogY1aWMpwzrlt89IXzXIwquSc EhO/O9sJs3YNRR+VnDyADBcaCOCcMein29j7TYQeir11otpP+nWSv4hJQDEHquycZp2j ow5mCWf3uL4Ixc/wDiSsv2LwnTogCXqvwuJVNhyqOm0hgi45y3Jq8+NfQcRHVsmvB6u4 kVgHLTqQKDlL7X9UvSKRCgwwzw6PUEQe9rIYm8Fp8zxmBBk5Etjg1RkstT54aV7+ilAm fAfl+D/hCNsDMK2axnKZbNkAUwxXP822MXGzO2+6TfkHDe9seI/ghV1uJZZ0LOyLwM8a ueug== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=ox4GXp8Bz3mHfw0xot9mGE0njujNiZsBLZN40TD5Mk4=; b=h73Ru6TAVz9ivz2bhhYIRu4cH1MJpuhvyMR6l/8yTio6dFRn88WpudGgE/NhK7eXua /PLXX6HvBoecfK77hnXvZ7s0fS/G2zSPaevpGkeH9ueLqybFtbhZg06XKY55sYH4DLqN KkDatONipRQIpz7IUx9wj2/6RhWqbpLJEwVbuPCgwNAKY4BXDwKN1Qn4dQMcZ/PyMtbl UinlxWeQ3Yj7J9KISF9T9iUHDTRgharcu1Do/AEy8xszNzeEo95C93dWrbH1pDFSLJCh VqUPEdsmuUiSRFwQHLXZ9pY4jF1eXWRxdaSscJFViFEcS+Le1TJ9NRpjQ0kCtkI49BeY oVdA== |
| X-Gm-Message-State | AEkooussgP7Y/yg9avR3GRBMSVb3nh2LHcokc00XJ/ujspONCmVDggjyEmHR6kb3RM0prw== |
| X-Received | by 10.66.78.35 with SMTP id y3mr13009614paw.40.1469255595060; Fri, 22 Jul 2016 23:33:15 -0700 (PDT) |
| Organization | IBM |
| X-Mailer | Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 49 |
| X-Original-Cc | linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com>, Paul Mackerras <paulus@samba.org>, David Gibson <david@gibson.dropbear.id.au> |
| X-Original-Date | Sat, 23 Jul 2016 16:33:07 +1000 |
| X-Original-Message-ID | <20160723163307.628999ce@roar.ozlabs.ibm.com> |
| X-Original-References | <1468989271-753-2-git-send-email-aik@ozlabs.ru> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1448895 |
Show key headers only | View raw
On Wed, 20 Jul 2016 14:34:30 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> static long tce_iommu_register_pages(struct tce_container *container,
> @@ -128,10 +129,17 @@ static long tce_iommu_register_pages(struct
> tce_container *container, ((vaddr + size) < vaddr))
> return -EINVAL;
>
> - ret = mm_iommu_get(vaddr, entries, &mem);
> + if (!container->mm) {
> + if (!current->mm)
> + return -ESRCH; /* process exited */
This shouldn't happen if we're a userspace process.
> +
> + atomic_inc(¤t->mm->mm_count);
> + container->mm = current->mm;
> + }
> +
> + ret = mm_iommu_get(container->mm, vaddr, entries, &mem);
Is it possible for processes (different mm) to be using the same
container?
> @@ -354,6 +362,8 @@ static void tce_iommu_release(void *iommu_data)
> tce_iommu_free_table(tbl);
> }
>
> + if (container->mm)
> + mmdrop(container->mm);
> tce_iommu_disable(container);
> mutex_destroy(&container->lock);
I'm wondering why keep the mm around at all. There is a bit of
locked_vm accounting there (which maybe doesn't exactly do the
right thing if we're talking about current task's rlimit if the
mm does not belong to current anyway).
The interesting cases are only the ones where a thread does
something with container->mm when current->mm != container->mm
(either a different process or a kernel thread). In what
situations does that happen?
Thanks,
Nick
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH kernel v2 0/2] powerpc/mm/iommu: Put pages on process exit Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-07-20 06:40 +0200
[PATCH kernel v2 2/2] powerpc/mm/iommu: Put pages on process exit Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-07-20 06:40 +0200
[PATCH kernel v2 1/2] powerpc/iommu: Stop using @current in mm_iommu_xxx Alexey Kardashevskiy <aik@ozlabs.ru> - 2016-07-20 06:40 +0200
Re: [kernel,v2,1/2] powerpc/iommu: Stop using @current in mm_iommu_xxx Nicholas Piggin <npiggin@ozlabs.au.ibm.com> - 2016-07-22 16:10 +0200
Re: [kernel,v2,1/2] powerpc/iommu: Stop using @current in mm_iommu_xxx Nicholas Piggin <npiggin@gmail.com> - 2016-07-23 08:40 +0200
csiph-web