From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0398F1FF7DA for ; Fri, 10 Jan 2025 08:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736497971; cv=none; b=X1GtmNxsUjhRRtWyaJ3pk1XIsykcWwRgGKJH63jJnQa4FgHyVuKwwS0pDWiyc94WDQvV7Z6E7zDqK34bQWuo3vvhYY5Qi/c0lsfliADt53LIOlgKsqJUaGLQH+7OSrsP4eXFqQKX8O1a1mYRHGeApnpz4g+5kRoFyaYFM8sgsXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736497971; c=relaxed/simple; bh=VGWc2r5DWkp5BEOS12CjavUaRnmM+7UV40Z0p/V+M4g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PMhUYCC7cXq4QOgTgJdwpl/TtVnfN/wtbGqI4QekVXIRSA3IBPa/fRcNN3Lvt1E78DdedXYX0ilxoU/PgyDMQ4v/5665OCO+ro2P3g76dbnH5ulbCMczDT6yaNdJWuFFxBLEMXxCR7pEQKT3uYiw5S8AUaDWMo4/dOal06kEszs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KLu+RjBi; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KLu+RjBi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736497967; h=from:from:reply-to:subject:subject: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=QNsiOXjqRdk4XnuvcNsSYTQ64OcsqQNsmoIU3zwwWOg=; b=KLu+RjBip7o9c2uM+KQYIzQNYO/JtOT4oWZw1BKLuUPJu+b529tXNZcblYl803ZZ+coUcR PPKUuaaJGXLujnr9jFsISDWc/6H5HwzS5+uKAF8rbOKnCJdstqNxcCaeMiR2q/kxEZyysl LoUaEvoSD/e5vgt/gW3TTiPMjwm1/Oo= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-_uMLklpFOJ6MRUnhE_ciow-1; Fri, 10 Jan 2025 03:32:46 -0500 X-MC-Unique: _uMLklpFOJ6MRUnhE_ciow-1 X-Mimecast-MFC-AGG-ID: _uMLklpFOJ6MRUnhE_ciow Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-38639b4f19cso1041824f8f.0 for ; Fri, 10 Jan 2025 00:32:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736497965; x=1737102765; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QNsiOXjqRdk4XnuvcNsSYTQ64OcsqQNsmoIU3zwwWOg=; b=pmqsU6NWUMMxMm0zX4oYpIKAXQ6JzlFTMWWHTBS9ArObJkj+49iI1U/15ydD4v6CVv uG8VURMwfqL18HNADrOjvwCKjZ6jpAId7Mb/lRsqiKCPenf3QeciaG9er4pkM1zOTZR+ wwzfwaC1Ey3Ew4u1A9rkqwVBO5EYdASH7sC8K6ETAd6uNcmz44S7bcpVl4GnD/K7c4IV ImMfCr8uFMTdae2VInBvA0FkoY9B7QTAR2Ull+k0FpimSB7aeMnqqXQ5oMnKhJPmbtRC cG10qv0y+d38k8LYKBUeTDk8sbqAM2O4oK5JDxgrrcLibSMGaJzDS2hVPBr+mEadBkBN leWw== X-Forwarded-Encrypted: i=1; AJvYcCVVZ6AOBvPULyL6pihacEGGcVIBbvAS13KY89B2ejo6aouZ/n7Qk2/rm6ffbqHdgCwlEF83beqjF64YxsA=@vger.kernel.org X-Gm-Message-State: AOJu0YzDvxh2j+8n8oVOJZMyWQMyzhn6Z4ggKzP4ONWnxe3iU6PvQJXo Li0bY9aycJymBLd9XWoW4mUBJpjQ/sehG0uEM7K/7Uy65m3J0LNrkr1y7z1PZWdJPHLwwzPSSLO xNEtllGBsYQFemRJAAV+yMMY2i4vBFR6uHf/+OCmP1BF5zpktd/en4mpZap2w7w== X-Gm-Gg: ASbGncvpM/NRNq4aRSfEcF/DOZF1detPaHClz7YtH6aNIf52uFto9v84DV+HBEIf6wo qbQ0zu1l7IE0WXicl3dmI60UhHPYBv2GszAcN0ttZTiswd7X8KkJbkTEix93JYJT1avhMGXWS3t 2HxZZsmEJnVv64FdBTKMILtfY40nxF7jpSjZ40CpLrN4l/5Qj3Ati8187M/76Dqt3guTaZFI1+v y3JwHFIks3pueqySrb3FCmYYXHRENF5RW5uYKpLQ6r2piZPCPqu X-Received: by 2002:a05:6000:4714:b0:386:33e3:853c with SMTP id ffacd0b85a97d-38a872fc034mr8254359f8f.12.1736497965393; Fri, 10 Jan 2025 00:32:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMC1XlIEOUefypcmHiBcEmLm9qBWhP+6Dt9pGprUw7p20L3Z1sA+aOZ6xBs7f0SCT1XF6q1Q== X-Received: by 2002:a05:6000:4714:b0:386:33e3:853c with SMTP id ffacd0b85a97d-38a872fc034mr8254341f8f.12.1736497965057; Fri, 10 Jan 2025 00:32:45 -0800 (PST) Received: from redhat.com ([2a06:c701:740d:3500:7f3a:4e66:9c0d:1416]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d17dsm3849954f8f.21.2025.01.10.00.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 00:32:44 -0800 (PST) Date: Fri, 10 Jan 2025 03:32:41 -0500 From: "Michael S. Tsirkin" To: Jason Wang Cc: xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] virtio_ring: skip cpu sync when mapping fails Message-ID: <20250110033113-mutt-send-email-mst@kernel.org> References: <20241111025538.2837-1-jasowang@redhat.com> <20250108063310-mutt-send-email-mst@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Jan 10, 2025 at 11:32:46AM +0800, Jason Wang wrote: > On Wed, Jan 8, 2025 at 7:35 PM Michael S. Tsirkin wrote: > > > > On Mon, Nov 11, 2024 at 10:55:38AM +0800, Jason Wang wrote: > > > There's no need to sync DMA for CPU on mapping errors. So this patch > > > skips the CPU sync in the error handling path of DMA mapping. > > > > > > Signed-off-by: Jason Wang > > > > > > So as I said, I do not get why we are optimizing error paths. > > The commit log at least needs to be improved to document > > the motivation. > > As replied before. Does the following make more sense? > > 1) dma_map_sg() did this > 2) When the driver tries to submit more buffers than SWIOTLB allows, > dma_map might fail, in these cases, bouncing is useless. > > Thanks About 2 - it's an error path. Is there a reason to think it's common? About 1 - ok reasonable. You can say "while we have no data on how common this is, it is consistent with what dma_map_sg does". -- MST