Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1476330lqp; Mon, 15 Apr 2024 07:38:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuk+ZLVIUNEghT68Tyvkkvktvpt6U7LedTOX1AMUKydFzeg+CEEO0EB60AmdNMI5oM8/Zhn4eO3Bmc/OR9lELHc0QGVKtpyY70edqe1g== X-Google-Smtp-Source: AGHT+IHrCUQK/w0rOb+8XhwgcmR5dDmJYoyrVpqusOsMPsXMA1inadozxlGy504Gll0e5x9qFylr X-Received: by 2002:a17:902:f685:b0:1e3:e093:b5f0 with SMTP id l5-20020a170902f68500b001e3e093b5f0mr13145790plg.8.1713191894560; Mon, 15 Apr 2024 07:38:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713191894; cv=pass; d=google.com; s=arc-20160816; b=lFKCnUyDAULA7BzqiOuaa7hHWvp7w9uvGiTWTOTfIVOw2LmQks7bN7HTsGclCeCzQb KY8Wdj03s7r/2370URqOVFbuH5KcuYDhsfqpl/KR1H0S/Xz6FaP2J4C+M9hqccUv60U9 rynWLmhAHuz/n508nDyksuvc6jJ3qbOEqxsR65mLMx8oxHnxi1U6h9wVo+mLmmjtzCac oYv1WNgwFUabKHHx9KWR8IMBJR3V0tbvMQQnOGxnVTJA8+TGn+oVLZg+L/oDp1+rrUV3 rUFPjbeOHKBTSoGLPk9kKXNLb6nHsKw45u913Gt7VjYaIdc7+j6wPx6mi5q2DD9ZvraU zpqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=vVrDx/bbmS5+gjreM3QEYo2TK7GLIM4cDsvY9MJ08SA=; fh=ItxsCWZX/d72iQIZ9lrgBmF9Vk/RHszKNAlG2c4Erxs=; b=k3Ixm1HgSUvKBpgRQSPaKjKwrZ23826hkxzv4VUWQHXrhK42jnrhNtLtY2dZRKg6JS 8cmS8Ty6bwN/x/chc4PKqoNRRUHQNTVJoL1aQGvZuFkH018gv61rV2MFmLbj6VRw+xqN b+UfSdePGtowJ++QVhacpGQhQRRfWAE9QPkpdmrTrxEEX968BWs7DkrTDB3m90YiQXxv gc/juZetITSLDJTXs5FiFfBnkZvATytUu8VZ2skIcpP3t55yW7A8ZxQdPts3j6G5P/pV PDmORbDupmfy35YkAGTe7FiT7vS1oBO1M/SNI/hGbalD+qKuKrH2AVekGq1mqFRitgAL 8Ufg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PSrJF6y7; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-145366-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s14-20020a170902ea0e00b001e40d171220si8105031plg.5.2024.04.15.07.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 07:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145366-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PSrJF6y7; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-145366-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E3FC5283888 for ; Mon, 15 Apr 2024 14:36:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E9CB8062B; Mon, 15 Apr 2024 14:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PSrJF6y7" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE3A78BF8 for ; Mon, 15 Apr 2024 14:33:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713191633; cv=none; b=tKugweAZNNv9tMyf9FXXP8S0FYDU3/lYLjgmNBRV68Y/KCTn5NzV+cMrMRo3yDt+jI9Qtcld9DYxbAEcBBrewisF3srwiTg05xEV1CrQB0em7xFyOMCpBPCYfqWR9VTa4HZcDXk1X4xNHjEI+4M0fghm5HuvsQGRBKztGhqhpz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713191633; c=relaxed/simple; bh=pZatBN48J9TWETE5SB7D46qgelWlOsIMx+cbhmR3oRg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=NEzmCrpqkywWB8tGzj0amdXRYzyhvdwCFogoMXEmLaN4bK+3eCHxPQVe3LuKXcLTfUzezeQJ92j7J06RjoAWa/mO5tnVY+BnHjnoFqaPrB/eUx4OIiN552VXYRVut9m3G7KRqDffQVkQF8G2rVJizUDwXKcTchrOy/97AI58Sjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PSrJF6y7; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713191630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vVrDx/bbmS5+gjreM3QEYo2TK7GLIM4cDsvY9MJ08SA=; b=PSrJF6y7aiS5T1P2j2v6WSPWlZAaEjIKLAqQLHCGbw6QcXPF8X8yE4z8433qR/qDGlDfxE Ry+JdbOSqo9Zymz+fb0VF077HP5VlQab0iO0GqM0PwoO/FoKnLzmf51nPd3XI65e552ZzP Uj1jU5swZBXapBDGxtjOPhw7UkH1LS8= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-185-TxHc3sXmNcuA3QNyA9HDDg-1; Mon, 15 Apr 2024 10:33:49 -0400 X-MC-Unique: TxHc3sXmNcuA3QNyA9HDDg-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-78d475004b6so521057985a.0 for ; Mon, 15 Apr 2024 07:33:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713191629; x=1713796429; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vVrDx/bbmS5+gjreM3QEYo2TK7GLIM4cDsvY9MJ08SA=; b=Ycb3qamGZBcGtVFuALcZbAuH/KDzO8LDNSCx/yihsDLK4jBMt4WRlVyzKT1Uh0Ssqv o66J6bxvFY2DGED7oZEa+MfWMw+eHQI0BapVMpINO7U+cC95oBCWBDaVpT43Hif++OaO qmmHNxCbCip9Hvzdtaq2DxWcfUivyhhH+ZL3lLGL78s4g9txiI4b1k6nVRcUOdRoYu+6 N95p8wNWPMNV4/WCOAXnNM6HYjwNmmgVFTD62dWYCH75FNsNlLuHSCw36W/7B/p72P7/ jUwoCo7y8JBHZT/ARKa2atqQmfaDkWuv6Zb+ImBOuRECMo1uudEt+/fXGrT6pqtjD4m/ sQPw== X-Forwarded-Encrypted: i=1; AJvYcCURwepkV5dCFjZmqp0iHrgeiCdTGsnzsRw4p0esc6WEB5oDHvElTVuL0A4pQczM08BoBLV+R2cGq73W4Z+VpX9JGnxH4Te1be13mmf9 X-Gm-Message-State: AOJu0Yw+LANUGwJfITpUyP2F8U2scnhbAmvlHuDuSYpMIUt3neZs67qA zmTpaCbLHX/cmEgSlfeo0l0jrDCgVhN59pOAnspBKTgTM8iJS1HqAQUFe18ydJ9WKbpwDcmm58L 1JeWxRcHutHUP67QtWHignH8H92Li1tmmQOyflX/I5u4aqYSNB0A/bH7O9FCv/A== X-Received: by 2002:a05:620a:3954:b0:78e:ddf7:6fe0 with SMTP id qs20-20020a05620a395400b0078eddf76fe0mr6573755qkn.12.1713191628941; Mon, 15 Apr 2024 07:33:48 -0700 (PDT) X-Received: by 2002:a05:620a:3954:b0:78e:ddf7:6fe0 with SMTP id qs20-20020a05620a395400b0078eddf76fe0mr6573724qkn.12.1713191628647; Mon, 15 Apr 2024 07:33:48 -0700 (PDT) Received: from vschneid-thinkpadt14sgen2i.remote.csb (213-44-141-166.abo.bbox.fr. [213.44.141.166]) by smtp.gmail.com with ESMTPSA id vq17-20020a05620a559100b0078ebb93d940sm6418319qkn.20.2024.04.15.07.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 07:33:48 -0700 (PDT) From: Valentin Schneider To: Eric Dumazet Cc: dccp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni , mleitner@redhat.com, David Ahern , Juri Lelli , Tomas Glozar , Sebastian Andrzej Siewior , Thomas Gleixner Subject: Re: [PATCH v5 0/2] tcp/dcpp: Un-pin tw_timer In-Reply-To: References: <20240415113436.3261042-1-vschneid@redhat.com> Date: Mon, 15 Apr 2024 16:33:44 +0200 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 15/04/24 14:35, Eric Dumazet wrote: > On Mon, Apr 15, 2024 at 1:34=E2=80=AFPM Valentin Schneider wrote: >> >> Hi, >> >> This is v5 of the series where the tw_timer is un-pinned to get rid of >> interferences in isolated CPUs setups. >> >> The first patch is a new one stemming from Jakub's bug reported. It's th= ere >> mainly to make the reviewing a bit easier, but as it changes behaviour i= t should >> be squashed with the second one. >> >> Revisions >> =3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> v4 -> v5 >> ++++++++ >> >> o Rebased against latest Linus' tree >> o Converted tw_timer into a delayed work following Jakub's bug report on= v4 >> http://lore.kernel.org/r/20240411100536.224fa1e7@kernel.org > > What was the issue again ? > > Please explain precisely why it was fundamentally tied to the use of > timers (and this was not possible to fix the issue without > adding work queues and more dependencies to TCP stack) In v4 I added the use of the ehash lock to serialize arming the timewait timer vs destroying it (inet_twsk_schedule() vs inet_twsk_deschedule_put()). Unfortunately, holding a lock both in a timer callback and in the context in which it is destroyed is invalid. AIUI the issue is as follows: CPUx CPUy spin_lock(foo); call_timer_fn() spin_lock(foo) // blocks timer_shutdown_sync() __timer_delete_sync() __try_to_del_timer_sync() // looped as long as timer is running In our case, we had in v4: inet_twsk_deschedule_put() spin_lock(ehash_lock); tw_timer_handler() inet_twsk_kill() spin_lock(ehash_lock); __inet_twsk_kill(); timer_shutdown_sync(&tw->tw_timer); The fix here is to move the timer deletion to a non-timer context. Workqueues fit the bill, and as the tw_timer_handler() would just = queue a work item, I converted it to a delayed_work.