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 0EA2F41CB0; Thu, 16 Feb 2023 10:22:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABECE40EE3; Thu, 16 Feb 2023 10:22:39 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id AF94840E0F for ; Thu, 16 Feb 2023 10:22:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676539357; x=1708075357; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=VYCMmdlOQumot/X9csvQSuDAyGdngE7X0HdCy+qYu+A=; b=igpPgxMje8REUkhK8+GYTfX5RPe5ACAmS8FptqOHQ3hHguue/32v+ARE 7JgpiUX2kDq+bzCg7oWJGy2j/7a/iqrSKjDTl3wd0oCG9wGHKPdSaVuPe xwPtHtMjiDteQHGkCyrEyK5s1iqHk4YnBoEee/x5nFTdxNDQDw28dvpvl Ky57McVwD8RdpvzLOqZfvPXVGLX7e+IJ0iJBZwWOmpjiiVw/i29S6k66f EbqEjILLxNe/BqgWYQ7QEC6fpnAr2uHgb5S5DkSdRQXzz/X8FjOoEFrL/ QhPlXKYw/8XWKqNhnWrgNU2G68pRQmXChkFRTxkP8+DykjSCj7Cy5vaVG g==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="319729134" X-IronPort-AV: E=Sophos;i="5.97,302,1669104000"; d="scan'208";a="319729134" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2023 01:22:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="793960650" X-IronPort-AV: E=Sophos;i="5.97,302,1669104000"; d="scan'208";a="793960650" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga004.jf.intel.com with ESMTP; 16 Feb 2023 01:22:13 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 16 Feb 2023 01:22:13 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 16 Feb 2023 01:22:12 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 16 Feb 2023 01:22:12 -0800 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 16 Feb 2023 01:22:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=meTAD08Qn3kJ3HhFOoOXi9lHvqiYq8oNp7+uxwT7TO63WqhXZijH7YExOi8Ov/6xlhzuUJNU14JRZAj8WE/OyZ1eo5l9Q8Y7yYecux9wbf/TJR+dnB69pNDG6tyM/KMkoZHjLMaGyBHADKEmlOKxeIfTMbVEeLOMGBidFb93lGBUM43g1o5P3oazHcCmzZnk+fKLbJZeaxzjUeGOxAMsVh/K/f4NsWURbvGuPVhI6Jfv7MqHNOVSrViBdULnjMNZqIzJ8nhIZ0A1Ir6jtNA9C7wuYX2Z7UV0Fb4iavjIm33nwm549LbGc7shU0QKxbK9ug5tFqpPaw73t3tUofCHkQ== 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=M2RtHDbkDuv6NWD/mfuwR2cwYuvSim8FP79fbzb3/EE=; b=NWvdWso9JDbqNfaZ1jL2hpZhQpdvdT9znSpor3V8OR5jMGgmcMH1M9r4Ky3dpKvUI94zLhUWAkJlrTyOMF1K7RVUUtutA8AcP6fTZ56hIpJJ5yOkdg9ORszVuesQO21SGgV72w/NtcZowAjYseSS7NM5u6H7wWd40WEFdcL3l78aEeXarRkvZzQyETCjxgW6NNwzZGHEdQqyLUEBprClJgDU3bY8+0NNPbhX4rmxQj8SW+ai+6O2dPSL2yCjU8h5r+cTjYOmhw5TmpPWxmQemv8fXpjAEIJtjfdTRQEbFbNEC3HWiPY/QQpeAsh/MpyLcewKJ9KFTgascFIq6P5qfA== 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 DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by CO1PR11MB5153.namprd11.prod.outlook.com (2603:10b6:303:95::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13; Thu, 16 Feb 2023 09:22:11 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::aaba:abb7:8794:def]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::aaba:abb7:8794:def%8]) with mapi id 15.20.6086.024; Thu, 16 Feb 2023 09:22:11 +0000 Date: Thu, 16 Feb 2023 09:22:04 +0000 From: Bruce Richardson To: fengchengwen CC: , , , , "Burakov, Anatoly" Subject: Re: [PATCH] eal/bsd: fix spinlock not unlock in alarm callback Message-ID: References: <20230213124452.46536-1-fengchengwen@huawei.com> <506fd32a-1d88-63fd-9fcb-c96a5b1b10b9@huawei.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <506fd32a-1d88-63fd-9fcb-c96a5b1b10b9@huawei.com> X-ClientProxiedBy: LO2P265CA0261.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::33) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CO1PR11MB5153:EE_ X-MS-Office365-Filtering-Correlation-Id: 989b4617-0cd5-4389-8a61-08db0fff487c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QkOPD7HsahjpQ//4mlzB5USIUNMwIdcfamyeIkvYoQTgtzMjAXNMtTmQjKdE0SDqdw3f7tAl+kZP0put9vNUkN9eR1nuFcf38uR/VBUf88bdY9xDwvWWrZe5W6HBp7TknC4HltKWw4q1zMIgNxJp1fQJBBt9hZWDREhrRpYkxKD4UhXuMeuFNUKKvZINDrrIAN7tdXmo19PHnXTI5wsnrLKfmQFn/0p2/k+aYcyOEPKFYzXvdIxgnszPMTqwGdoGbcULwQtsJXcLcHy7eUrbPw3w38d+ks+luR8MocLsVIfpeN+AfObGsPW29MpxlxodH3BYtgTwbfpQS8RGfxBeMDEFbeSz4EVOg4cfNdU4yoSUZdGaoRsAly4E9InHFqQ0/WbCkcsRkPCe9GaKgIvLJT9PVr17lYMwetQnx4DPeBAad8gDbsp3ykkOwXaltZzCRYvPQ3v4ZljCHMcfu8F33YWRa+Fz4allbn4KUZ/8XZLtrkD31r4ogMs1JWbup4WgKhzmzMoCSYOINM3hnOKnTn3pfoWWYpc/BPSvP4U2YTLEoW5q0GwoQsegmHXQM3vunYWAKVVk+YWrx6v/1NraKgNiqxo3wLBNrVFMjVTyIFv7Pm75dmoADDEmpIkJddtXrgy3f+Uc8QxucY9Geh+DYg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(366004)(376002)(396003)(39860400002)(136003)(346002)(451199018)(478600001)(83380400001)(53546011)(6506007)(6666004)(26005)(6512007)(186003)(107886003)(2906002)(6486002)(316002)(5660300002)(4326008)(6916009)(41300700001)(44832011)(8936002)(8676002)(66946007)(66476007)(66556008)(38100700002)(86362001)(82960400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?y17hsro0cEwYI3D5bosgdX3Ml+W6QmbHSFrXae+9V/V8Q2elgbfeHJ3tYNu+?= =?us-ascii?Q?RMHzKsM1xckPD5FP3SpxVJZstPLugd3ixu/yVKyoZLziwQct/tCJz/JTqphL?= =?us-ascii?Q?9LrXbFddnztjnGh3tLeq7XCtkvhNG8rRfLs8B5xIjttZByVO/TV9Crl78GM0?= =?us-ascii?Q?DIwPXbyNcYJSS9YUUPWe2k8NvzJtpEGBNlVMAPTo5RzneLyZbZodEZxx9OTx?= =?us-ascii?Q?hE04pZMscmYIFs0yxjZj6Epthh76sxYR1tCKhBiyD6Rl47fxvQAbludUBqKl?= =?us-ascii?Q?cLGxlUABc9v+2oghWU8Ac8gPqmIn9qd/T4FX4ZbdXfF6JFgjpX7NVKbmPEnp?= =?us-ascii?Q?yDYSA/Q6c0GH5aO+mhRPqG6gWMiIqwxxFNO8eGgTgqs8asGCydESgo8dMvAq?= =?us-ascii?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2RsfGkS6GmOJk8cORZ?= =?us-ascii?Q?NKMTGyqZlZRTW6PNsKF9XDUcDf7+qRSimiwle0a4bLmhA8IYV65OeAgEcAU+?= =?us-ascii?Q?QTXzDB8v48NL96918UXltEt3zfLnTVgTl2w9RmcxRChhhHfGjwSyFl3PyFMf?= =?us-ascii?Q?lC1JEv4/aZKoHRZ/QmtvB8DUweEMUBn6UR9Z3r7JCqn30Rgh1wlSJAJiXP4J?= =?us-ascii?Q?/O8+cTZchn9152loGOjP2J2Uc0yiHEF3lE+K7aPuN5mD2aKHG8MYBZcmCWdD?= =?us-ascii?Q?AUvNEeOiSGorwUnlOR0rIlwGHxXcVdL6hH9OJkB4P6J9HmJrGFlgYFspR14j?= =?us-ascii?Q?6Q=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 989b4617-0cd5-4389-8a61-08db0fff487c X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 09:22:11.2756 (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: 2nyFcOpDPoXdEgf/JxFrwsNNyhMegHCH8Y31Nx5tjITSBFTe7FlBZROPVrnaBtkr1aYMl3VZ7W1VvQ14AHPz0bC/WM4GsvRtrBUE2A3LY8I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5153 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Feb 16, 2023 at 09:28:17AM +0800, fengchengwen wrote: > add cc maintainer > > On 2023/2/13 20:44, Chengwen Feng wrote: > > The spinlock should unlock when clock_gettime() failed. This patch > > fixes it by invoking clock_gettime() before lock. > > > > Fixes: 26021a715067 ("eal/bsd: support alarm API") > > Cc: stable@dpdk.org > > > > Signed-off-by: Chengwen Feng > > --- > > lib/eal/freebsd/eal_alarm.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c > > index 1023c32937..1a3e6c0aad 100644 > > --- a/lib/eal/freebsd/eal_alarm.c > > +++ b/lib/eal/freebsd/eal_alarm.c > > @@ -171,12 +171,12 @@ eal_alarm_callback(void *arg __rte_unused) > > struct timespec now; > > struct alarm_entry *ap; > > > > - rte_spinlock_lock(&alarm_list_lk); > > - ap = LIST_FIRST(&alarm_list); > > - > > if (clock_gettime(CLOCK_TYPE_ID, &now) < 0) > > return; > > > > + rte_spinlock_lock(&alarm_list_lk); > > + ap = LIST_FIRST(&alarm_list); > > + > > while (ap != NULL && timespec_cmp(&now, &ap->time) >= 0) { > > ap->executing = 1; > > ap->executing_id = pthread_self(); > > Acked-by: Bruce Richardson