From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEFD4C3F6B0 for ; Mon, 22 Aug 2022 18:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237545AbiHVSdq (ORCPT ); Mon, 22 Aug 2022 14:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237505AbiHVScz (ORCPT ); Mon, 22 Aug 2022 14:32:55 -0400 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 094C44AD45 for ; Mon, 22 Aug 2022 11:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1661193149; x=1692729149; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aK4MPOmSwHEbMjrlRR8e4yzRmp0rvHn1j9I0VnyhUWI=; b=lL/ttysTxR9Yr9dMHOFL9ABcwqs5cFxcjufn7PSDczj+NgFnkS3m34vB Xhr0/nBCbmZCEkFSvbGD8fKVua/xaDQUmBfFMcyVAw875rXjcu/gmPY3I eqCDxIQ6I6A6aJZIneg0HkyqOe5+6dbEmtGFBDjVWvS3O4rmH75Rq5467 k=; X-IronPort-AV: E=Sophos;i="5.93,255,1654560000"; d="scan'208";a="236167820" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-iad-1a-4ba5c7da.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2022 18:32:17 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-iad-1a-4ba5c7da.us-east-1.amazon.com (Postfix) with ESMTPS id EE3AC8115E; Mon, 22 Aug 2022 18:32:15 +0000 (UTC) Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Mon, 22 Aug 2022 18:32:14 +0000 Received: from 88665a182662.ant.amazon.com (10.43.161.172) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.12; Mon, 22 Aug 2022 18:32:12 +0000 From: Kuniyuki Iwashima To: CC: , , , , , Subject: Re: [PATCH v3 net 05/17] ratelimit: Fix data-races in ___ratelimit(). Date: Mon, 22 Aug 2022 11:32:05 -0700 Message-ID: <20220822183205.19735-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220819170446.77eeb642@kernel.org> References: <20220819170446.77eeb642@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.43.161.172] X-ClientProxiedBy: EX13D08UWB004.ant.amazon.com (10.43.161.232) To EX19D004ANA001.ant.amazon.com (10.37.240.138) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jakub Kicinski Date: Fri, 19 Aug 2022 17:04:46 -0700 > On Thu, 18 Aug 2022 11:26:41 -0700 Kuniyuki Iwashima wrote: > > + int interval = READ_ONCE(rs->interval); > > + int burst = READ_ONCE(rs->burst); > > Also feels a little bit like papering over an issue if we read > two values separately. Exactly, we have to protect it with a single lock. Considering ___ratelimit() can be called in many paths, it seems better to add a spin lock in struct ratelimit_state. Thank you.