Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1565868pxy; Mon, 2 Aug 2021 05:09:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSWz1isBj767Th0fL+tenIWSlIbDHnKYWz77NMYFgP5KXsdINxCWLDnXflScbJ8nrbhvsw X-Received: by 2002:a6b:e417:: with SMTP id u23mr749932iog.91.1627906152122; Mon, 02 Aug 2021 05:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627906152; cv=none; d=google.com; s=arc-20160816; b=DHRe0qxiFQtl3nGmxnaweYAOF1qxtNCKZd9s65saUbJrtn3jNxi9WgGBQ8OYuStTyf GsesjV7O2cOh4WdJdAe/8Ykbj+1ZQ6MEuHg/jSf4IXN+KmFcF+SQzp5108s4zbJHU/xA suOUC5m9eqJ31xR3UKF6DcPBN0lx4/hJLeaJ5FATzmKGmLLnfjoD82ojqjBZ/AI9/CWW mj8eqvjoPvktcji814pc5zHg5JdbmrZo3l31m0bXx/cGdzlVnss8mcv/gVQ0SCCDqgUS SxEt+zKfqUiwPFpqbzoRyI2zM/runwnI6AGWFYfvQl11KBK+Dx5soT3Nq1kTe/kJqGVy FBXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4cx+LEdN/r/a/0XdAXrbDvkiMBm+57d3vn/M+lYSx/k=; b=XKI48M2sBAJfVhszLPLFZTpWIXThfAKwMTjMw0z8osaXuio4maz5LvHrxXPpHnT02a v6ez4p1i4CCKaXi+rnEPt9czg0I1unxtDKLuHzjISBZFgdVgP9024+CC7WH1xXSLqBlw TixtUTpTJS4IMj4iWXJEdkFL0Iwu9lLWOEscVVpEajg+nUGKpF1WGjZX75ECGwKxsuGN jh94dwFBdzfvtKQgISPTx/qcNa3Ku784DbLMr5dmpxg8Tbwy2EKv8mMNG/fz3rddIl37 YuXmALys/6/MsYJcbHrAAfYu0ziOlbUIDaVfzZQTxYo0jxI8L9LEwyg/eQjquGzRIr21 IG4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si14977361ilu.1.2021.08.02.05.09.01; Mon, 02 Aug 2021 05:09:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233629AbhHBMIN (ORCPT + 99 others); Mon, 2 Aug 2021 08:08:13 -0400 Received: from 8bytes.org ([81.169.241.247]:52786 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233516AbhHBMIM (ORCPT ); Mon, 2 Aug 2021 08:08:12 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id BBD92379; Mon, 2 Aug 2021 14:08:00 +0200 (CEST) Date: Mon, 2 Aug 2021 14:07:59 +0200 From: Joerg Roedel To: Tianyu Lan Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, will@kernel.org, davem@davemloft.net, kuba@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com, arnd@arndb.de, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ardb@kernel.org, Tianyu.Lan@microsoft.com, rientjes@google.com, martin.b.radev@gmail.com, akpm@linux-foundation.org, rppt@kernel.org, kirill.shutemov@linux.intel.com, aneesh.kumar@linux.ibm.com, krish.sadhukhan@oracle.com, saravanand@fb.com, xen-devel@lists.xenproject.org, pgonda@google.com, david@redhat.com, keescook@chromium.org, hannes@cmpxchg.org, sfr@canb.auug.org.au, michael.h.kelley@microsoft.com, iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, vkuznets@redhat.com, anparri@microsoft.com Subject: Re: [PATCH 04/13] HV: Mark vmbus ring buffer visible to host in Isolation VM Message-ID: References: <20210728145232.285861-1-ltykernel@gmail.com> <20210728145232.285861-5-ltykernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210728145232.285861-5-ltykernel@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 10:52:19AM -0400, Tianyu Lan wrote: > + if (type == HV_GPADL_BUFFER) > + index = 0; > + else > + index = channel->gpadl_range[1].gpadlhandle ? 2 : 1; Hmm... This doesn't look very robust. Can you set fixed indexes for different buffer types? HV_GPADL_BUFFER already has fixed index 0. But as it is implemented here you risk that index 2 gets overwritten by subsequent calls.