From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA6FC45EF4 for ; Fri, 20 Dec 2024 05:59:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A046D402A9; Fri, 20 Dec 2024 05:59:59 +0100 (CET) Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by mails.dpdk.org (Postfix) with ESMTP id 4E74640144 for ; Fri, 20 Dec 2024 05:59:56 +0100 (CET) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7fd35b301bdso1269376a12.2 for ; Thu, 19 Dec 2024 20:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734670796; x=1735275596; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=MnEngEivVTHM2bAoGsEGHIg8ZeHnE06VTyKObrbdwiY=; b=anb9g/IN7uWygzvq4ITce08CrddH0fc2F68Pjo2MuTKd7Gs1jATIKDPX78DbnlAE3N HIeg+kpiN6NepviiTJ/xEC9ySuCMqixJHCrioNVenFS4b6oDvrSVeFf2QG89u8rwTM7G Ha/y+huYcUUT9M9injd6MQzHlpVRqlduOj3ap1lAWWcyRqoEOGB/WnRPA7Mh0KYhISyf fbgepJR7qphD8qIAg7XLn7Dpin8xuNL+NqG1hU87I7G3PY/eGgx6Drm/NbPpaSSRDNgh naiO6vWCU89NR5f5CF17HgFRTQZrP4uZCPf6FbJViCT9jD/CGhQ6e2d/qZFXems/D01A vFmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734670796; x=1735275596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MnEngEivVTHM2bAoGsEGHIg8ZeHnE06VTyKObrbdwiY=; b=LZQXpSwciRixbmwtlJSMkybDR2afELWXWxDhDb+vm7ZsZuB8VYOdJK/T9+YC/V0Zxc OAZuPsIs1K9KUazqBO/kOtc2WEST2345sufwaUMyefAgtcri21yGQPDtyDtOAM9i08NF s+y27P4wlM75TB1TZWaxpCNg3ocg2/T8R9qslMVq6FCWhaRFZv6NS6xzlT/xTljEhWbS CMGBC45ZxB68AOtIQYxEf9stI7I/ZNScmBeyQnIWr2g6KOBYqXRCww0hQDn6jQAIsjWD m0Q4zoXfM8Bi2mJkzg/ZFCm2zrY5uwwCWC5wJdAzp9UiYcY5bSnDYZE1tcg6Qmo6RpCY e6AA== X-Forwarded-Encrypted: i=1; AJvYcCWPOJsqYfP3LhN8KZZuZvFBLaZ7JNlZhDVDBiuN+Q0rdTLniD0lzLnWSbadoLYtkU/+sevP54Q=@dpdk.org X-Gm-Message-State: AOJu0YxVlm+b8r4gOGy5ruLd9MZR4oR0XfEOih0XrNG2h4lPCoE3ZHgC qqZZ1Qlu710PmqxwGYQa5tbwR+c8du//oX9Fi6fURKEmf4fujovb4tA+yKNb1oQ= X-Gm-Gg: ASbGncuu7YQKw/5byMbAjRghodSRKfQPOweW8tJnV0zZuXr8aVm8vTrQGt2RaOAk5E/ LDqVxT3ehX08+YN5qUMQv2jVxofwHEr+CM262NgDcIB5kJqYudkzJ8VSOEH6CgNy3mD2iOb29BK ap7Tw9wGudBWNei4WHC15EWMt9KzjOba/dYMNCDAesrIPL7tRqi1JVcsrq9HiMWH1DRnHB6kmWv 8CDW9ta1XfRKcmJPaRBphvh8keSCQzv5fBgL0VXWlMyCXyVmufQziRIlQPliRcfAjSO50O7qdHx w+doM+1luzF0GSZm5pRmnDrFzr2VWeIYCw== X-Google-Smtp-Source: AGHT+IECZgOYZ4EmDBmjBaIN2g9qZmvegQJDiLSZF1F7KskAZ9znKP867z5FzGfTWQLeMw/vHU0ASQ== X-Received: by 2002:a05:6a21:998b:b0:1e0:b5ae:8fc1 with SMTP id adf61e73a8af0-1e5e0484570mr2671942637.13.1734670795845; Thu, 19 Dec 2024 20:59:55 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842b84fb8ddsm2033647a12.42.2024.12.19.20.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:59:55 -0800 (PST) Date: Thu, 19 Dec 2024 20:59:52 -0800 From: Stephen Hemminger To: "Wangyunjian(wangyunjian,TongTu)" Cc: "dev@dpdk.org" , "maxime.coquelin@redhat.com" , "chenbox@nvidia.com" , "Lilijun (Jerry)" , "xiawei (H)" , wangzengyuan , "stable@dpdk.org" Subject: Re: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading Message-ID: <20241219205952.08c09ae7@hermes.local> In-Reply-To: References: <91dc12662805a3867413940f856ba9454b91c579.1734588243.git.wangyunjian@huawei.com> <20241219081532.345c7536@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Fri, 20 Dec 2024 02:17:12 +0000 "Wangyunjian(wangyunjian,TongTu)" wrote: > > -----Original Message----- > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Friday, December 20, 2024 12:16 AM > > To: Wangyunjian(wangyunjian,TongTu) > > Cc: dev@dpdk.org; maxime.coquelin@redhat.com; chenbox@nvidia.com; > > Lilijun (Jerry) ; xiawei (H) ; > > wangzengyuan ; stable@dpdk.org > > Subject: Re: [PATCH 1/1] vhost: fix a double fetch when dequeue offloading > > > > On Thu, 19 Dec 2024 14:38:28 +0800 > > Yunjian Wang wrote: > > > > > - hdr = (struct virtio_net_hdr *)((uintptr_t)buf_vec[0].buf_addr); > > > + rte_memcpy((void *)(uintptr_t)&tmp_hdr, > > > + (void *)(uintptr_t)buf_vec[0].buf_addr, > > > + sizeof(struct virtio_net_hdr)); > > > } > > > > Do not introduce more rte_memcpy of a fixed size. > > You don't need that many casts! > > Why can you not use a structure assignment here. > > The virtio_hdr is a shared component, and other fields within it are read > multiple times. This can potentially result in a double fetch scenario. The point is do a copy, but not with rte_memcpy. Also you need a rte_compiler_barrier() anyway.