All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Tianyu Lan <ltykernel@gmail.com>
Cc: kys@microsoft.com, haiyangz@microsoft.com,
	sthemmin@microsoft.com, wei.liu@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com,
	arnd@arndb.de, akpm@linux-foundation.org,
	gregkh@linuxfoundation.org, konrad.wilk@oracle.com, hch@lst.de,
	m.szyprowski@samsung.com, robin.murphy@arm.com, joro@8bytes.org,
	will@kernel.org, davem@davemloft.net, kuba@kernel.org,
	jejb@linux.ibm.com, martin.petersen@oracle.com,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-scsi@vger.kernel.org,
	netdev@vger.kernel.org, vkuznets@redhat.com,
	thomas.lendacky@amd.com, brijesh.singh@amd.com,
	sunilmut@microsoft.com
Subject: Re: [Resend RFC PATCH V2 11/12] HV/Netvsc: Add Isolation VM support for netvsc driver
Date: Wed, 14 Apr 2021 17:50:16 +0200	[thread overview]
Message-ID: <20210414155016.GE32045@lst.de> (raw)
In-Reply-To: <20210414144945.3460554-12-ltykernel@gmail.com>

> +struct dma_range {
> +	dma_addr_t dma;
> +	u32 mapping_size;
> +};

That's a rather generic name that is bound to create a conflict sooner
or later.

>  #include "hyperv_net.h"
>  #include "netvsc_trace.h"
> +#include "../../hv/hyperv_vmbus.h"

Please move public interfaces out of the private header rather than doing
this.

> +	if (hv_isolation_type_snp()) {
> +		area = get_vm_area(buf_size, VM_IOREMAP);

Err, no.  get_vm_area is private a for a reason.

> +		if (!area)
> +			goto cleanup;
> +
> +		vaddr = (unsigned long)area->addr;
> +		for (i = 0; i < buf_size / HV_HYP_PAGE_SIZE; i++) {
> +			extra_phys = (virt_to_hvpfn(net_device->recv_buf + i * HV_HYP_PAGE_SIZE)
> +				<< HV_HYP_PAGE_SHIFT) + ms_hyperv.shared_gpa_boundary;
> +			ret |= ioremap_page_range(vaddr + i * HV_HYP_PAGE_SIZE,
> +					   vaddr + (i + 1) * HV_HYP_PAGE_SIZE,
> +					   extra_phys, PAGE_KERNEL_IO);
> +		}
> +
> +		if (ret)
> +			goto cleanup;

And this is not something a driver should ever do.  I think you are badly
reimplementing functionality that should be in the dma coherent allocator
here.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Tianyu Lan <ltykernel@gmail.com>
Cc: linux-hyperv@vger.kernel.org, brijesh.singh@amd.com,
	linux-mm@kvack.org, hpa@zytor.com, kys@microsoft.com,
	will@kernel.org, hch@lst.de, linux-arch@vger.kernel.org,
	wei.liu@kernel.org, sthemmin@microsoft.com,
	linux-scsi@vger.kernel.org, x86@kernel.org, mingo@redhat.com,
	kuba@kernel.org, jejb@linux.ibm.com, thomas.lendacky@amd.com,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	arnd@arndb.de, konrad.wilk@oracle.com, haiyangz@microsoft.com,
	bp@alien8.de, tglx@linutronix.de, vkuznets@redhat.com,
	martin.petersen@oracle.com, gregkh@linuxfoundation.org,
	sunilmut@microsoft.com, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, netdev@vger.kernel.org,
	akpm@linux-foundation.org, robin.murphy@arm.com,
	davem@davemloft.net
Subject: Re: [Resend RFC PATCH V2 11/12] HV/Netvsc: Add Isolation VM support for netvsc driver
Date: Wed, 14 Apr 2021 17:50:16 +0200	[thread overview]
Message-ID: <20210414155016.GE32045@lst.de> (raw)
In-Reply-To: <20210414144945.3460554-12-ltykernel@gmail.com>

> +struct dma_range {
> +	dma_addr_t dma;
> +	u32 mapping_size;
> +};

That's a rather generic name that is bound to create a conflict sooner
or later.

>  #include "hyperv_net.h"
>  #include "netvsc_trace.h"
> +#include "../../hv/hyperv_vmbus.h"

Please move public interfaces out of the private header rather than doing
this.

> +	if (hv_isolation_type_snp()) {
> +		area = get_vm_area(buf_size, VM_IOREMAP);

Err, no.  get_vm_area is private a for a reason.

> +		if (!area)
> +			goto cleanup;
> +
> +		vaddr = (unsigned long)area->addr;
> +		for (i = 0; i < buf_size / HV_HYP_PAGE_SIZE; i++) {
> +			extra_phys = (virt_to_hvpfn(net_device->recv_buf + i * HV_HYP_PAGE_SIZE)
> +				<< HV_HYP_PAGE_SHIFT) + ms_hyperv.shared_gpa_boundary;
> +			ret |= ioremap_page_range(vaddr + i * HV_HYP_PAGE_SIZE,
> +					   vaddr + (i + 1) * HV_HYP_PAGE_SIZE,
> +					   extra_phys, PAGE_KERNEL_IO);
> +		}
> +
> +		if (ret)
> +			goto cleanup;

And this is not something a driver should ever do.  I think you are badly
reimplementing functionality that should be in the dma coherent allocator
here.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-04-14 15:51 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 14:49 [Resend RFC PATCH V2 00/12] x86/Hyper-V: Add Hyper-V Isolation VM support Tianyu Lan
2021-04-14 14:49 ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 01/12] x86/HV: Initialize GHCB page in Isolation VM Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 02/12] x86/HV: Initialize shared memory boundary " Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 03/12] x86/Hyper-V: Add new hvcall guest address host visibility support Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 15:40   ` Christoph Hellwig
2021-04-14 15:40     ` Christoph Hellwig
2021-04-15  8:13     ` Tianyu Lan
2021-04-15  8:13       ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 04/12] HV: Add Write/Read MSR registers via ghcb Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 15:41   ` Christoph Hellwig
2021-04-14 15:41     ` Christoph Hellwig
2021-04-15  8:19     ` Tianyu Lan
2021-04-15  8:19       ` Tianyu Lan
2021-04-15 18:11   ` Konrad Rzeszutek Wilk
2021-04-15 18:11     ` Konrad Rzeszutek Wilk
2021-04-14 14:49 ` [Resend RFC PATCH V2 05/12] HV: Add ghcb hvcall support for SNP VM Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 06/12] HV/Vmbus: Add SNP support for VMbus channel initiate message Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-15 18:52   ` Konrad Rzeszutek Wilk
2021-04-15 18:52     ` Konrad Rzeszutek Wilk
2021-04-14 14:49 ` [Resend RFC PATCH V2 07/12] HV/Vmbus: Initialize VMbus ring buffer for Isolation VM Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-15 20:24   ` Konrad Rzeszutek Wilk
2021-04-15 20:24     ` Konrad Rzeszutek Wilk
2021-04-19  6:36     ` Christoph Hellwig
2021-04-19  6:36       ` Christoph Hellwig
2021-04-14 14:49 ` [Resend RFC PATCH V2 08/12] UIO/Hyper-V: Not load UIO HV driver in the isolation VM Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 15:42   ` Christoph Hellwig
2021-04-14 15:42     ` Christoph Hellwig
2021-04-14 15:45   ` Greg KH
2021-04-14 15:45     ` Greg KH
2021-04-14 16:17     ` Stephen Hemminger
2021-04-14 16:17       ` Stephen Hemminger
2021-04-15 12:54       ` Tianyu Lan
2021-04-15 12:54         ` Tianyu Lan
2021-04-15 13:09     ` Tianyu Lan
2021-04-15 13:09       ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 09/12] swiotlb: Add bounce buffer remap address setting function Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-15 20:28   ` Konrad Rzeszutek Wilk
2021-04-15 20:28     ` Konrad Rzeszutek Wilk
2021-04-14 14:49 ` [Resend RFC PATCH V2 10/12] HV/IOMMU: Add Hyper-V dma ops support Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 15:47   ` Christoph Hellwig
2021-04-14 15:47     ` Christoph Hellwig
2021-05-12 16:01     ` Tianyu Lan
2021-05-12 16:01       ` Tianyu Lan
2021-05-12 17:29       ` Robin Murphy
2021-05-12 17:29         ` Robin Murphy
2021-05-13  3:19       ` Lu Baolu
2021-05-13  3:19         ` Lu Baolu
2021-04-14 14:49 ` [Resend RFC PATCH V2 11/12] HV/Netvsc: Add Isolation VM support for netvsc driver Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 15:50   ` Christoph Hellwig [this message]
2021-04-14 15:50     ` Christoph Hellwig
2021-04-15  8:39     ` Tianyu Lan
2021-04-15  8:39       ` Tianyu Lan
2021-04-14 14:49 ` [Resend RFC PATCH V2 12/12] HV/Storvsc: Add Isolation VM support for storvsc driver Tianyu Lan
2021-04-14 14:49   ` Tianyu Lan
2021-04-14 15:51   ` Christoph Hellwig
2021-04-14 15:51     ` Christoph Hellwig

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=20210414155016.GE32045@lst.de \
    --to=hch@lst.de \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jejb@linux.ibm.com \
    --cc=joro@8bytes.org \
    --cc=konrad.wilk@oracle.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ltykernel@gmail.com \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sthemmin@microsoft.com \
    --cc=sunilmut@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@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.