Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1315269pxv; Fri, 2 Jul 2021 00:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhSVME81Gl+qa750EBQIPK7dhyZLfknz4YcyGVHq81VMrJpzsYS7brXgc4bst6PfDNXlQt X-Received: by 2002:a05:6e02:530:: with SMTP id h16mr2409163ils.262.1625210183822; Fri, 02 Jul 2021 00:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625210183; cv=none; d=google.com; s=arc-20160816; b=H3Y8i0IVKW1wjkbGRGZIFwQXUsCTh5d459Woetqxa745vseDUpre9BNe2EqkNx9wMB pcQF6NSOkh1EpqQCye33bcWb+Z+UZpuOzP/+VBcGAAFJzLHgCWhVdn9UquG5sRRbINKJ lLmfl74P+kLogPZf7CkNy4RzvSYF5HIpQxIHKGvBXRdS+EQ6u/YCtb+M+RDr+BXhtmsu 4X44Z7GTgzSM0E3/eHgBT3R5H+qdiEy20346lYdMiXBX7Ap7+XEGWupGcsdcUBDJVAaF C8JcPxAJdmgslJO16tlvaYo4pA2H5+jMuf7AVWG4ol6q33jc+5fTjCAOp9A/W3SH8i9B 1lMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=RkEhpluxMTkOu3Hgww0CFdlJOC9OTEZYiGLSoQZ5k08=; b=CwWbh+YkU2b9t0ULdD8GsijyAi5RksbqNxrESlZrDXeLbttKKEaRr+SAVPotzPXNzo Hq8lDgL6MfzJGsOQOmbi9vJa21X6gbLB+mWGxMQTL9rEX+RaNS/rugl7gwnjWTK7heOO rJ7qllZ2G4w4Zbg+9FVEUc7VzDXBG10ESGsyCML3Dg0HSOBgz2t4kkapmm1QtOd1kWbj +hOrBUCyzPnvEDfQ1Ssa04ff8etL67lCxzB+4JWMcHDl4uoOVaJ+e8kUtq2MfrXt+zN5 zGBxh/s72Wxsk8sEcXTRVelAziq30tBXS9XSj3ho55pzpoX6Wsb0F9UgH16Ny5i0pAub 1ulQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si1857119ila.83.2021.07.02.00.16.10; Fri, 02 Jul 2021 00:16:23 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230115AbhGBHR6 (ORCPT + 99 others); Fri, 2 Jul 2021 03:17:58 -0400 Received: from mga03.intel.com ([134.134.136.65]:1933 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbhGBHRy (ORCPT ); Fri, 2 Jul 2021 03:17:54 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10032"; a="208726771" X-IronPort-AV: E=Sophos;i="5.83,316,1616482800"; d="scan'208";a="208726771" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 00:15:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,316,1616482800"; d="scan'208";a="482197260" Received: from dengjie-mobl1.ccr.corp.intel.com (HELO [10.239.154.58]) ([10.239.154.58]) by FMSMGA003.fm.intel.com with ESMTP; 02 Jul 2021 00:15:19 -0700 Subject: Re: [PATCH v11] i2c: virtio: add a virtio i2c frontend driver To: Viresh Kumar Cc: Wolfram Sang , linux-i2c@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, mst@redhat.com, arnd@arndb.de, jasowang@redhat.com, andriy.shevchenko@linux.intel.com, yu1.wang@intel.com, shuo.a.liu@intel.com, conghui.chen@intel.com, stefanha@redhat.com References: <510c876952efa693339ab0d6cc78ba7be9ef6897.1625104206.git.jie.deng@intel.com> <20210701040436.p7kega6rzeqz5tlm@vireshk-i7> <20210702045512.u4dvbapoc5a2a4jb@vireshk-i7> <409b6cc3-3339-61b2-7f42-0c69b6486bb3@intel.com> <20210702065625.qielhnfyrlvrtrkk@vireshk-i7> From: Jie Deng Message-ID: Date: Fri, 2 Jul 2021 15:15:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210702065625.qielhnfyrlvrtrkk@vireshk-i7> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/7/2 14:56, Viresh Kumar wrote: > On 02-07-21, 14:52, Jie Deng wrote: >> This is not efficient. If adding the ith request to the queue fails, we can >> still send >> >> the requests before it. > Not really. Normally the requests which are sent together by clients, are linked > together, like a state machine. So if the first one is sent, but not the second > one, then there is not going to be any meaningful result of that. > > The i2c core doesn't club requests together from different clients in a single > i2c_transfer() call. So you must assume i2c_transfer(), irrespective of the > number of underlying messages in it, as atomic. If you fail, the client is going > to retry everything again or assume it failed completely. Then what is the need to design this interface as "return the number of messages successfully processed, or a negative value on error". Just return success or fail is enough. Here, we didn't break the contract with the interface "master_xfer", so if there is a problem then the contract may be the problem.