Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp31767lqc; Thu, 7 Mar 2024 09:26:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVv+VdRvuRdLi4bUrls2oO8uF1AFVljj3YgDsu9hctBmDAqBRIDs72K1E9TmiWuNtxubzvm3HUqB+41caVlliwGWjV28gcMD+Fsv9644A== X-Google-Smtp-Source: AGHT+IHWeZAIo7kBuGlaJ+F70u3Zx8Zanum9WlfFWNRPq9vlyvoHKyAkHej7vK2MdStgcaVEM3Bf X-Received: by 2002:a17:902:d551:b0:1d9:d341:b150 with SMTP id z17-20020a170902d55100b001d9d341b150mr10833128plf.40.1709832393480; Thu, 07 Mar 2024 09:26:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709832393; cv=pass; d=google.com; s=arc-20160816; b=fvsn4MDsxYU2Bo9n8MXkn5cSEfxIKWjx+pDSQygKX4ZIWanE5rVdSD4JsCHfHCHRoJ PrANJsRJQdQbTLmxdpW6W808n19dAmozO7LS+/DJE5v2VAbTO8kgl2/dxS+g48NqZVPS GsOsmabHIyg73j4zWzC4fGk+6i6FGYHpKi0zNgnKj/o+hPbDF84CPmC917MmLWzh9VDQ wq5wM8w/hgnfESm50P0uqS/N8RcGRaeDL3mIVozaGBPmNwneCzllY9Chmro4tYJJUchv iRP/63GrJYAC+0OxGtVi4V8Vkd+P3bPVy/CgivM0QtqEwcLHNaVzlN6q0doSeTQN23Ep UIPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=typJzsyCZ7d0N2AWtsRnRkkZEuqyJ1S5uCH3hrAdMlA=; fh=5C8v9sN26rRCoe7AF4+kXw4kcw4GwlcYgcbvV8d71Zg=; b=AIEhnuiVKmhz3jvwm7lHlZFMrMQX5NMiUwvbIClzb3dhVkfG8yDoEtb8R6oVSiClwJ Hw+wl+s/ZTyr9oHmDsd8OIqPmkx7uNLMCVBncoZoPsOPlOSlNDGvOIQXwcHFa9+XB8qu 15ZBMSsInimI2j0rfYOFo5W3y0EKlUx+LZKrZcm04n0bKjgtsygZ1yM8enJ1bxYa0gNm T7ksZcMD461ExxOlBrUAaaeeIDteYzffjoUE4lpDoSuAWUpYacytcdg68W2sp3gDhJSP 8PxEs9L02N408fgKwsGrje02O+rIRlwxBy4cLX7Ogy6sdeA0DCAyXLrdxHdHy8OPYyCU ADhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Ayz90ujO; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-95936-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f6-20020a170902684600b001d9859103e0si427182pln.153.2024.03.07.09.26.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 09:26:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95936-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=@linux.dev header.s=key1 header.b=Ayz90ujO; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-95936-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 2AB74286AAB for ; Thu, 7 Mar 2024 17:26:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A52912FF90; Thu, 7 Mar 2024 17:26:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Ayz90ujO" Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 343CE12FF8C for ; Thu, 7 Mar 2024 17:26:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709832385; cv=none; b=a6/jMfIHscBiktxEpAz223hC8Rv9pDmHFJaSox/ijmL2qCPhl805fUF+/jleVCGeTcL47rLhinSnV/Ogq+tfv+M50FkP1rdjYMfzPm+zui7sjDNP8DA3YG61U+2isY0NEq1Hu5x0GkmRBhSRf5vHjR5VeoUL3pihCDkD81WHFT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709832385; c=relaxed/simple; bh=4VKRPFROZxhfecLCGFPUt9H94MPeeXyOxYoh30MmVek=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mEJffSuzr58em9DZ0gHE0SMoOf0wm3OsS5IK76962wQhMT/74vr/G8rkcTzSERjYAH8b8XgGNc248xsUM1aCbfrVU7iZUDSZH67WLUKK1qCpAvgQlUk64AD8Nc5DaDLFuKMa/vtWP/e68UslsG/KnqGivGwIxwTL4iRQnB/88rs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Ayz90ujO; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <49ca7920-d429-434a-aede-1a200e8d5ce8@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709832381; 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=typJzsyCZ7d0N2AWtsRnRkkZEuqyJ1S5uCH3hrAdMlA=; b=Ayz90ujO9VGGPBPBUzhJG/0z3frrtSSosfU6bd3HdfMioTtavGW2EUkG1Ej2q8KtTF8siq RiawcerkWVH1IqmUaJplOxSyFkFQ6Pu5Pbk+Kpe8G0KcewTfjN36YOsuCYE3oGj2f4d4Q5 tQ5GrYK9qaIeKxKrjhRKtUdwZsGwHTM= Date: Thu, 7 Mar 2024 12:26:00 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [RESEND2 PATCH net v4 2/2] soc: fsl: qbman: Use raw spinlock for cgr_lock Content-Language: en-US To: Christophe Leroy , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "netdev@vger.kernel.org" Cc: Vladimir Oltean , Roy Pledge , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Li Yang , Scott Wood , Claudiu Manoil , Camelia Groza , Steffen Trumtrar , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" References: <20240222170749.2607485-1-sean.anderson@linux.dev> <20240222170749.2607485-2-sean.anderson@linux.dev> <53b401d7-934c-4937-ab83-6732af47668d@csgroup.eu> <34da1e7b-029e-410b-8735-a10d6d267e2b@linux.dev> <6764b9c5-b61a-4f20-a41a-125d5015a3e6@linux.dev> <63ab7b62-853c-4996-a493-465283252d5a@csgroup.eu> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sean Anderson In-Reply-To: <63ab7b62-853c-4996-a493-465283252d5a@csgroup.eu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 3/5/24 17:18, Christophe Leroy wrote: > > > Le 05/03/2024 à 19:14, Sean Anderson a écrit : >> [Vous ne recevez pas souvent de courriers de sean.anderson@linux.dev. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] >> >> Hi, >> >> On 2/23/24 11:02, Sean Anderson wrote: >>> On 2/23/24 00:38, Christophe Leroy wrote: >>>> Le 22/02/2024 à 18:07, Sean Anderson a écrit : >>>>> [Vous ne recevez pas souvent de courriers de sean.anderson@linux.dev. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] >>>>> >>>>> cgr_lock may be locked with interrupts already disabled by >>>>> smp_call_function_single. As such, we must use a raw spinlock to avoid >>>>> problems on PREEMPT_RT kernels. Although this bug has existed for a >>>>> while, it was not apparent until commit ef2a8d5478b9 ("net: dpaa: Adjust >>>>> queue depth on rate change") which invokes smp_call_function_single via >>>>> qman_update_cgr_safe every time a link goes up or down. >>>> >>>> Why a raw spinlock to avoid problems on PREEMPT_RT, can you elaborate ? >>> >>> smp_call_function always runs its callback in hard IRQ context, even on >>> PREEMPT_RT, where spinlocks can sleep. So we need to use raw spinlocks >>> to ensure we aren't waiting on a sleeping task. See the first bug report >>> for more discussion. >>> >>> In the longer term it would be better to switch to some other >>> abstraction. >> >> Does this make sense to you? > > Yes that fine, thanks for the clarification. Maybe you can explain that > in the patch description in case you send a v5. Hm, I thought I put this description in the commit message already. Maybe something like | smp_call_function always runs its callback in hard IRQ context, even on | PREEMPT_RT, where spinlocks can sleep. So we need to use a raw spinlock | for cgr_lock to ensure we aren't waiting on a sleeping task. | | Although this bug has existed for a while, it was not apparent until | commit ef2a8d5478b9 ("net: dpaa: Adjust queue depth on rate change") | which invokes smp_call_function_single via qman_update_cgr_safe every | time a link goes up or down. would be clearer. --Sean