Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp368558pxb; Thu, 17 Feb 2022 06:01:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7XzXXqsgyREqAi5/SHZwO+S3T349FthDIjFvPXW34CuH+Mz/5ynXdg9p/yH7Ab9wHaTdq X-Received: by 2002:a17:906:8457:b0:6cf:741b:dfaa with SMTP id e23-20020a170906845700b006cf741bdfaamr2409636ejy.700.1645106515008; Thu, 17 Feb 2022 06:01:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645106514; cv=none; d=google.com; s=arc-20160816; b=xfuHv8eSXTJ/TnORdj3EHfchFj5mAt5BAPAnSUkEchYOol0rmwuvaujx3m2OS0T6kD baWtCp9g1HbuSTGhUhjzkHzfvb0S0HTk99MXndJwJUhRDwUAzgWeGleGrawu2AXUDCtK 2b/r5xUd7eL996Hl041JTDTrm7VKCY0FFRTOdbE08ovF7QN1I+gyymEQwj7zpvxK/FTC VvMYLdlWqbdUrTnMPsFVil/0P+FLMAJOXcXhCW5xOad8RJK1aOxgcE+I8CfYffsE49zn aHQKXn4PEBhetj76/91Rm3Wdf8orKCzHDeIK/E/u1GxuNyUK5LbvgQEnGps64uUFZHqc x9ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0Kz4EGDlXx7ZPbu9qxMCGvYLChPLKXTZq3ldjSVkxCA=; b=xVAHBFmR5xcck5hyVxb+NO9pFLtBkgzgZjXf+t+FxYq14ZpQ3kxDWyMonFXPXRnqUs UNAD4Jj4v2qTa+uzw8Xq+HjOIItWDBVZ2yuWxed4HP13I5oBTT4vyAAV/RnsyMUh5TpL eGJdo+F8NT8myoEUkuQ4dIeJJ3Gd5tAXd2wtmZvA6fJVSaFjVfQKm2aHXsHNEcw/vyME /3qyDAlmr3PRdxZZmynxQZUp4y2hrONkUnCu84yKOtQ3JDW1/1d5gacWOkj7l92aLTS2 7o+K7odLU20HJEH+a34IuKePyuFlYhE7YtZcel1SQUroJWROK0sEHepg+HzzIS+m/yP7 Mn7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QU7LJvep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9si1187607edz.481.2022.02.17.06.01.24; Thu, 17 Feb 2022 06:01:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QU7LJvep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240430AbiBQM3E (ORCPT + 99 others); Thu, 17 Feb 2022 07:29:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbiBQM3D (ORCPT ); Thu, 17 Feb 2022 07:29:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 674191732C1; Thu, 17 Feb 2022 04:28:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01351618D6; Thu, 17 Feb 2022 12:28:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B41E8C340E8; Thu, 17 Feb 2022 12:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645100928; bh=hL/L8b4BKTDSEL6x9ErWbSWgnedtCgnztDYMuXioWCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QU7LJvepojWAFAgruilB0ehE54VngITJb5bW13FTGehcQ/yIvmU/s+VWcJwv8YfED UQXSmxRW8WYG7WIAHyyPGF4VNkCpUZWVf6wzKCICjxxzlbGI/CHKqmdZxCP5hRbKG6 r1oha79XzUM0dVikBAq1uLPRbrGv9rbEBfCXYYQ0= Date: Thu, 17 Feb 2022 13:28:45 +0100 From: Greg KH To: Xiaoguang Wang Cc: Guixin Liu , bostroesser@gmail.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, xlpang@linux.alibaba.com Subject: Re: [PATCH 2/2] scsi:target:tcmu: reduce once copy by using uio ioctl Message-ID: References: <1645064962-94123-1-git-send-email-kanie@linux.alibaba.com> <1645064962-94123-2-git-send-email-kanie@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 17, 2022 at 07:13:07PM +0800, Xiaoguang Wang wrote: > hi, > > > On Thu, Feb 17, 2022 at 10:29:22AM +0800, Guixin Liu wrote: > > > --- a/include/uapi/linux/target_core_user.h > > > +++ b/include/uapi/linux/target_core_user.h > > > @@ -185,4 +185,13 @@ enum tcmu_genl_attr { > > > }; > > > #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1) > > > +struct tcmu_data_xfer { > > > + unsigned short cmd_id; > > > + unsigned long iov_cnt; > > > + struct iovec __user *iovec; > > > +}; > > That is no way to define a structure that crosses the user/kernel > > boundry, it just will not work at all, even if we wanted it to :( > Sorry, I don't quite understand your comments well, can you explain more why > this structure > does not work, except that "unsigned short" or "unsigned long" here isn't > correct, should use > u16 or u32. __u32 and __u16 must be used for structures like this. Also it's unaligned and has a hole in it, and will cause problems with compilers. You didn't try this on a 32/64bit system either :( thanks, greg k-h