Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp138807iog; Tue, 14 Jun 2022 21:52:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfekxfYsxa8HqGfk7do1HQ2WW3e/0LfzOjf1yikGApk7Oy63wu3YGd8UgQsPbZC6JtZVg0 X-Received: by 2002:a05:6402:5208:b0:431:3a5e:758c with SMTP id s8-20020a056402520800b004313a5e758cmr10636209edd.250.1655268742978; Tue, 14 Jun 2022 21:52:22 -0700 (PDT) Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb36-20020a1709077ea400b007122fd0e855si14836541ejc.633.2022.06.14.21.51.57; Tue, 14 Jun 2022 21:52:22 -0700 (PDT) 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=@intel.com header.s=Intel header.b=Y5v5wACs; arc=fail (signature failed); 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235593AbiFOESp (ORCPT + 99 others); Wed, 15 Jun 2022 00:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234067AbiFOESn (ORCPT ); Wed, 15 Jun 2022 00:18:43 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D408F4A3F7; Tue, 14 Jun 2022 21:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655266722; x=1686802722; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=RAwT4sNZajwkr9AmI8kob3r3qSmavigBxRxkj2BnNVY=; b=Y5v5wACsLpQzNPc384KdNaB8Tmv3HwRDzduuRQ7uRs3nnxREtq+dADPi QKaSotSUTmZjLE1CY+HG/p+1v4/8LiNezP6UNe4K4VTDrHhO6PFShHlM6 3x9zVPxhhlhf2VgyLmJIFhKwQw4po+9t2I7AQwrgMhquPnsJZsM9Zy7el Wd/slp2ZJJLOkxoOC90ze8gvCVBKfU16WfQcDDiV09xsWFZUkzCxkXUy0 /XtLySP5n6Ww+vnTzYL///iiBrINX7IOWYwrb7P4NCOna+UVC59nfwwIz zgT+TrXjRN32xBBIs0rnmMmxXms6h373KnRKLxMw+U72YnLoVTEaLFUrj A==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="365178201" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="365178201" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 21:18:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="687071159" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga002.fm.intel.com with ESMTP; 14 Jun 2022 21:18:42 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 14 Jun 2022 21:18:42 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Tue, 14 Jun 2022 21:18:42 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Tue, 14 Jun 2022 21:18:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEYf7DKPWjxNeF4bBm2oUO7/jS1Y3R6B3MqPHIki6U9CQRT8owKqhdsEEmUKCqKwQgFSxgLmCojtfwh/ZDY/x2gB5lilO4K5HaePudv13JItMdFqvh1iLBEnWPkMecIf7Tj2A4YpOKEUsXzyTWKD6xhFDKSnBqIF4mUYFEU4HjPeeB8KwXB9GUCd2uhYXf3h9DXv2lPqFfU1qKZiBFSGB6xbU3VKPJ+ceLMD8VR3WZiHHzCw0WBeETNPB8JipRCpx4esjgPuE1NewImWP8cCdx2vyyB2AiWaWwfn3J7UQRhi1NT6Fz/YZ1xvFkG2hR34J8DNNXZypB+fcos4jxxQ5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2oLI0mNN++8B0XG4z2vdLcOkCkJJUNpctykVgNfZ22g=; b=AnPzKpL+26UE01/mBLmkIB3qGHGtZvU0DYFwgw0cHtOpB9ODtRUzWgERgwKyOMJ42TKgI1jamNVJbfQ8D/W/B0YqmyM4m9J4nTnoM19RvfeKHAnbwDMDVRNTNvUdv8Stdgz/L50x3K73chJa9q3LpvFOjpe2G3dksDb2tWOvfJupB1h9rAyc29ph0HIxCNb4IfdrBpa7UzZlOIQXmVMN9G0RtA47IscQOH3xtHOKOmQDxwvB7ewZ07uzL6WPRuQu12q8GwpLP6YYLdNUO7kfIV03U37Nz1v8PfOIh78ORtL7wCuunq8ejkCYhv0LPS/RWOFUIHuXfmX3wQ5RSY6rGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6311.namprd11.prod.outlook.com (2603:10b6:8:a6::21) by MN2PR11MB3632.namprd11.prod.outlook.com (2603:10b6:208:ec::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.13; Wed, 15 Jun 2022 04:18:40 +0000 Received: from DM4PR11MB6311.namprd11.prod.outlook.com ([fe80::d4e9:9ae1:29b2:90c]) by DM4PR11MB6311.namprd11.prod.outlook.com ([fe80::d4e9:9ae1:29b2:90c%5]) with mapi id 15.20.5332.020; Wed, 15 Jun 2022 04:18:40 +0000 Date: Tue, 14 Jun 2022 21:18:34 -0700 From: Ira Weiny To: "Li, Ming" CC: Dan Williams , Bjorn Helgaas , Jonathan Cameron , "Alison Schofield" , Vishal Verma , Dave Jiang , Ben Widawsky , , , Subject: Re: [PATCH V11 3/8] PCI: Create PCI library functions in support of DOE mailboxes. Message-ID: References: <20220610202259.3544623-1-ira.weiny@intel.com> <20220610202259.3544623-4-ira.weiny@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MWHPR19CA0006.namprd19.prod.outlook.com (2603:10b6:300:d4::16) To DM4PR11MB6311.namprd11.prod.outlook.com (2603:10b6:8:a6::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a6d9d76-f9d2-4bb3-cd88-08da4e86206a X-MS-TrafficTypeDiagnostic: MN2PR11MB3632:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qtJ3zZrD4O3RALoZ1LFiMpRad23QxGYtvRBO15Qt6Yi6XBn9ybDFXneBLzbpswoGcbnIMLMc5SUOhOb+7FPLevY7Y5kS6S8Olr47TnH9iterAlvJ6759QATHQwQKllJAlToWWghmX7Mm96ynAHwOddF03Ifs6CTqVJC2G5vs7LJDJaKLWil6ddB5299cVIE5255i9Rlu/nLumPmkoJucToMp7nVZHbfNS9vb4Ax6PIrz4iIpyZWfzu2vXdsRRyaQFWKnBPp4z1yK2DNB00Ac04VQn1hZXz8V4PmW+rTWPQGoS4IvZoDtbtdSfW5JW6pYQ5rlHnbWI1UhW+qY/ODXKXxhQui1IScIf+VdVqflVia+ctkPYJZAnLcz2mh14aMzTd1dA8XPdt1J/ll6gy9F7XyzjSvojR2Q3iOiBknGExPuWFjI3/3oFXIzLf3U4EPnuD5yXNuaQMitKpRAhEYDJBcGRh7uUqCR+JspBawTo7I/a6fz9vNoupZ4vhwLm/eifo7+0WF1IJenyokpQmIj1VgCjl/u4bXzehuoKTsAqOzBGpCHTGZuhX5yIib2C6lfhEfxGRjK9nv3wBdWJ0Fe/24l/MChDDvFn1fp5G0cVXjMCu50xOYrmPvI1DSlSF1V3POuEfFg8/FOqH+icPFNZA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB6311.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(366004)(8936002)(6862004)(508600001)(82960400001)(5660300002)(44832011)(6636002)(54906003)(15650500001)(316002)(8676002)(66476007)(6486002)(4326008)(66946007)(66556008)(6506007)(53546011)(6666004)(9686003)(6512007)(83380400001)(186003)(86362001)(26005)(38100700002)(2906002)(33716001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Mess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vTxgKlxzb20LGPRlTOYfi1ZVeM=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0a6d9d76-f9d2-4bb3-cd88-08da4e86206a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6311.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2022 04:18:40.4363 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: z1ppAwR2V5FaXmQZnbTZAp3epf82154rtqJPIhk9pNokEW/Yf70PuKQtb6wKHF/XSMlLHFvgmCohRVP92xyLbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3632 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 Tue, Jun 14, 2022 at 11:53:29AM +0800, Li, Ming wrote: > > > On 6/11/2022 4:22 AM, ira.weiny@intel.com wrote: > > From: Jonathan Cameron > > [snip] > > + > > +/** > > + * pci_doe_submit_task() - Submit a task to be processed by the state machine > > + * > > + * @doe_mb: DOE mailbox capability to submit to > > + * @task: task to be queued > > + * > > + * Submit a DOE task (request/response) to the DOE mailbox to be processed. > > + * Returns upon queueing the task object. If the queue is full this function > > + * will sleep until there is room in the queue. > > + * > > + * task->complete will be called when the state machine is done processing this > > + * task. > > + * > > + * Excess data will be discarded. > > + * > > + * RETURNS: 0 when task has been successful queued, -ERRNO on error > > + */ > > +int pci_doe_submit_task(struct pci_doe_mb *doe_mb, struct pci_doe_task *task) > > +{ > > + if (!pci_doe_supports_prot(doe_mb, task->prot.vid, task->prot.type)) > > + return -EINVAL; > > + > > + /* DOE requests must be a whole number of DW */ > > + if (task->request_pl_sz % sizeof(u32)) > > + return -EINVAL; > > + > > +again: > > + spin_lock(&doe_mb->task_lock); > > + if (doe_mb->cur_task) { > > + spin_unlock(&doe_mb->task_lock); > > + wait_event_interruptible(doe_mb->wq, doe_mb->cur_task == NULL); > Hi, > do we need to check the returned value of wait_event_interruptible() here? if the returned value is -ERESTARTSYS, I think we should not try it again, just return. > I'm not 100% sure it is necessary. However, I don't think there is a point in trying to continue if a system thread is interrupted. So yea I think this is a good idea. Ira