Received: by 10.192.165.148 with SMTP id m20csp4712115imm; Tue, 1 May 2018 02:17:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr4t/6c0darGYr6lzUJsUYOce73qMpq2arYEQvbnYZEDwvTNr+5pLip0tLVtgTQj4VrSfAQ X-Received: by 2002:a17:902:1347:: with SMTP id r7-v6mr15202602ple.62.1525166225150; Tue, 01 May 2018 02:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525166225; cv=none; d=google.com; s=arc-20160816; b=J7bc23VVZWDxc654k9YLhsqB5Q0MYqD9BiUhMO87A93Y3vjNtfCf1gJDicme3SXM0o 8ZH+2SBHGgHPp4VCXllCk+QLoFtzlr34EH9tNEt/fYqAq+enftDw6dzg42FwSFFs3mGl AYXX6PY8FANE3lYrL78Qv7QSeI7Jo96aqEpkrztTKugga+xOsr5+9l4MwcU3Xz3g1Eba yBAZryY0RlGwHWx0sePCe6Jzecb/pb7vHYqmy7cWF6fZz8dyIs1K3GDlS3c2yEOO7ldH ZSrBk+MzIqY8EO45p4pBLx6XssXJrkXK3pyQ53fxsvml6MORe+eHQ+ubcYgID5RZ0i2S DM6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=AN9zcnUluVHVYp7O5jqMlyaZ1YtPzSKjnIJtaR1hmrw=; b=Be8FmTlHQdZ8qYZvkfe7RrAvclm1quK5kRZEYyZo+kiR5mNvVyiLzSYFDqmelJBYZ8 k39MV843tycuiKUAEnZb/C+9rgVExoFypbRbZ6s5YQgdXoRxhKxj1ji3UKHoQeLS/ZkL 06cygk8/wxxbCXVhrhPaF8HCP/STZL3rv4c6PzMWNA71JnCpzNWdLLyw0xZTJanuz45z MPan4LIkQjQR1mj02Z7ujgwDfnpb9vj76AhIA6DuvSW6teOHvbpxXsUm1qB2ZrCuFLCC r1vaB15COiHY4nw7mw41iX1HAktRUQzHyOUag2lJW6tdRCXDhp2rT0ZYWMu0VF7sC1ri 1NdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7-v6si9463316plt.197.2018.05.01.02.16.50; Tue, 01 May 2018 02:17:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755547AbeEAJP4 (ORCPT + 99 others); Tue, 1 May 2018 05:15:56 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:27513 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754550AbeEAJPw (ORCPT ); Tue, 1 May 2018 05:15:52 -0400 X-IronPort-AV: E=Sophos;i="5.49,350,1520899200"; d="scan'208";a="72420768" Date: Tue, 1 May 2018 10:15:26 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Roger Pau =?utf-8?B?TW9ubsOp?= CC: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= , Juergen Gross , Jens Axboe , open list , , "open list:BLOCK LAYER" , , Boris Ostrovsky Subject: Re: [Xen-devel] [PATCH 6/6] xen-blkfront: prepare request locally, only then put it on the shared ring Message-ID: <20180501091526.6b6j6h6rh62646fx@MacBook-Pro-de-Roger.local> References: <951a221b0e655b3077d1f96ac365194320bc8809.1525122026.git-series.marmarek@invisiblethingslab.com> <20180501082231.dzdbcghtwvlbkoys@MacBook-Pro-de-Roger.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180501082231.dzdbcghtwvlbkoys@MacBook-Pro-de-Roger.local> User-Agent: NeoMutt/20180323 X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 01, 2018 at 09:22:31AM +0100, Roger Pau Monn? wrote: > On Mon, Apr 30, 2018 at 11:01:50PM +0200, Marek Marczykowski-G?recki wrote: > > struct request *req, > > - struct blkif_request **ring_req) > > + struct blkif_request *ring_req) > > { > > unsigned long id; > > > > - *ring_req = RING_GET_REQUEST(&rinfo->ring, rinfo->ring.req_prod_pvt); > > - rinfo->ring.req_prod_pvt++; > > - > > id = get_id_from_freelist(rinfo); > > rinfo->shadow[id].request = req; > > rinfo->shadow[id].status = REQ_WAITING; > > rinfo->shadow[id].associated_id = NO_ASSOCIATED_ID; > > > > - (*ring_req)->u.rw.id = id; > > + ring_req->u.rw.id = id; > > > > return id; > > } > > @@ -545,23 +542,28 @@ static unsigned long blkif_ring_get_request(struct blkfront_ring_info *rinfo, > > static int blkif_queue_discard_req(struct request *req, struct blkfront_ring_info *rinfo) > > { > > struct blkfront_info *info = rinfo->dev_info; > > - struct blkif_request *ring_req; > > + struct blkif_request ring_req = { 0 }; > > unsigned long id; > > > > /* Fill out a communications ring structure. */ > > id = blkif_ring_get_request(rinfo, req, &ring_req); > > Maybe I'm missing something obvious here, but you are adding a struct > allocated on the stack to the shadow ring copy, isn't this dangerous? The above comment is wrong, you are storing a pointer to 'req' in the shadow ring copy, which is fine and is not the ring request. Roger.