Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3068088pxj; Mon, 17 May 2021 16:58:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw05Xj5THWie2buTEnFghUXpqU4eHtSw3QMExCO1lonNCH/HdrW7444shlM1DiJ9lIW4Xsd X-Received: by 2002:a17:906:3ec9:: with SMTP id d9mr2696799ejj.479.1621295895974; Mon, 17 May 2021 16:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621295895; cv=none; d=google.com; s=arc-20160816; b=fHP+twr9lYITFGmK/PE14e9E+7w77LQYsgA0qgGeRFhHkwiDgL76iT2oKuhRk43jnr zz2kigIOsrUWkhLmwtBLv3eejh8LZFAKHJGhqy5uztuYSASmEVFSevTOEl7byBswAvgr 5ffnGYZ7q6UdlzZjuu1UTemiRqIjQ+x8iBaBFai+14iS4EvYReBn+CygQPGt/KeFdtg0 GRVm7IFM566AmpuRTGtWSpi61VbCpRwMzvltwM5BTcGAVdhWBS6syXZsjcqzqLsXEuDq C0B8+JtOKVt+sH4E75mDrB4wagEwcVvfNdMp8ow89EmXVVxxduh4by4CycH0X9dk40n3 AipQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=pBvkavdK2+tEKfPns8/0KtXvMxeeFCb6/eSO70iXjJI=; b=A+JXI2ojmPwvdNG5kuVjI6zMnjJD3st3yWmpCF4EkOsZ4dpO3zWQ9kUu8TB63CMO89 41lxXONBmWSwN5rpI/RKL4T4jP57YRdF6t7LcVul1zJPTFF/hMlSqXobLNWMvyUSBhPo 4MIojhz+z4T+Z45VOht99hbDamdlBpPfiuIJOMdpzii7K7OZZE4x7vW/IijRPb6vcjjf gvXwStHsAY+wrZ8Rjv3ZJpKdrlEUXEhHZclLrmcYYwlms95Q/Zhe6FB9u8kxVvTmCrf8 POFId8skmY0bMEgMR80Zwx7yhhP+Qow4U6fjLYwx/tbQGzDJu4xE86pBp8F59506+xRo bpQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=KLTOub7T; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si16772771ejy.43.2021.05.17.16.57.50; Mon, 17 May 2021 16:58:15 -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; dkim=pass header.i=@suse.com header.s=susede1 header.b=KLTOub7T; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238943AbhEQOZS (ORCPT + 99 others); Mon, 17 May 2021 10:25:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:50520 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238856AbhEQOVm (ORCPT ); Mon, 17 May 2021 10:21:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1621261224; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pBvkavdK2+tEKfPns8/0KtXvMxeeFCb6/eSO70iXjJI=; b=KLTOub7TZSUOtkuHjpjekTAeT7wCeVfOQvosdmBXGcqwk4DiC/5/awqVvT7u7JBOfoHIyE v7KGYFo5pFFclu6Ss7cK58jfDScXMPZZBsPG4CyN9PmNL1hEk1EfZO+4UK8ttQkgRhH+L2 e/oEsvaU+rkOSW2y8kZNRwFlPjxMsro= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C0BC3B271; Mon, 17 May 2021 14:20:23 +0000 (UTC) Subject: Re: [PATCH 5/8] xen/netfront: read response from backend only once To: Juergen Gross Cc: Boris Ostrovsky , Stefano Stabellini , "David S. Miller" , Jakub Kicinski , xen-devel@lists.xenproject.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210513100302.22027-1-jgross@suse.com> <20210513100302.22027-6-jgross@suse.com> From: Jan Beulich Message-ID: Date: Mon, 17 May 2021 16:20:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210513100302.22027-6-jgross@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13.05.2021 12:02, Juergen Gross wrote: > In order to avoid problems in case the backend is modifying a response > on the ring page while the frontend has already seen it, just read the > response into a local buffer in one go and then operate on that buffer > only. > > Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich with one remark: > @@ -830,24 +830,22 @@ static int xennet_get_extras(struct netfront_queue *queue, > break; > } > > - extra = (struct xen_netif_extra_info *) > - RING_GET_RESPONSE(&queue->rx, ++cons); > + RING_COPY_RESPONSE(&queue->rx, ++cons, &extra); > > - if (unlikely(!extra->type || > - extra->type >= XEN_NETIF_EXTRA_TYPE_MAX)) { > + if (unlikely(!extra.type || > + extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) { > if (net_ratelimit()) > dev_warn(dev, "Invalid extra type: %d\n", > - extra->type); > + extra.type); > err = -EINVAL; > } else { > - memcpy(&extras[extra->type - 1], extra, > - sizeof(*extra)); > + memcpy(&extras[extra.type - 1], &extra, sizeof(extra)); Maybe take the opportunity and switch to (type safe) structure assignment? Jan