Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3807743pxu; Mon, 12 Oct 2020 01:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRx3I/saUDmCcFp7ZTUoOIMbj/J/HPRPU3wWAcml/xmczbY90XafI8Bhn7aeJn1+wYyd1X X-Received: by 2002:a50:88a3:: with SMTP id d32mr12832745edd.192.1602491064914; Mon, 12 Oct 2020 01:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602491064; cv=none; d=google.com; s=arc-20160816; b=helb1v+bMrJP+eb0Yr/e0RzVE9Bxmt+6+peIxbNRpKl2vOaQ+tTrkaLMqJ908ElYs9 kMZB6Hm/F3+rrWUjgcVkf6CeiAWlul4V2sd9AGxYrArVyjTyu4fQVURmcdSXEPP/J2m0 BxOsQuFy59UdWZl7vgKtCihYBEJPasTTi1Ok8VHfKFPDrz87HSrYz+g6UK0BeXH82Rbl mhUwYvwx3H3vkS4p6iw5jcREy84mPmhQc1qjAoCoRjGCWI4c3gmXpv7n7xT27urq77xO pbq2BhcSY8ylAc5RLMFjiWqREGQ5RZvsrl7w2TrGjIQDT4J8NuguGC62mqFpsebd8tMN QcpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iVMTNfZPhpmjUvWqwlb2u6mv5fmTTCfQRSLZkL9cblY=; b=WfEGkx9e8m6YYtdGkkPYM9RNS3PJlldpeUVX36H64IrIQD16eJx6DTO4yhIHrEoaja NbeO16NLziwK6zGb0KY5TDK0XGP+nCn18d2qh5iI2eNCmxbuKHAuI3psFFBECMIDhXAA plLSU4DUXP8F0NO+JNbgmArXkcf7O+C+2DhPHQ4/Y4aOks3u31wUpPjlEtZJ3SrmymbL tGY5GudFSurulUUpLJmOCUDjp0Nl/h8rPPbDIagDqN+btVI+QMrpg2gwNi+cJSeNglRk 47FH274v85JNKptr9Pqwtpyfs5g7pOBuFTSLfchw8JGOco28ay4CbFceHXGrvazvDqqQ VgCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NdiCPTEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 65si11670153edc.222.2020.10.12.01.24.02; Mon, 12 Oct 2020 01:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NdiCPTEw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729180AbgJLIO4 (ORCPT + 99 others); Mon, 12 Oct 2020 04:14:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29240 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728700AbgJLIO4 (ORCPT ); Mon, 12 Oct 2020 04:14:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602490494; 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=iVMTNfZPhpmjUvWqwlb2u6mv5fmTTCfQRSLZkL9cblY=; b=NdiCPTEwsFGEICD2NSeOgj7BR0YDOsCh/Wma2DtL5LVcpc9QPh76I1twoYbh2eerA6e0Y3 hoW6uch8JloYo8yBXkTMQK258gV5W8Y1FzO6tf0Q9QBp7qPidnuTUt9WNl17YHcTG8a4xk gjaVIOBqnTPLWsbm3dnYnV+PEPxizm4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-eLkQHV8xPPyqrp4SGbLINA-1; Mon, 12 Oct 2020 04:14:52 -0400 X-MC-Unique: eLkQHV8xPPyqrp4SGbLINA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF4F418BE164; Mon, 12 Oct 2020 08:14:50 +0000 (UTC) Received: from [10.36.112.220] (ovpn-112-220.ams2.redhat.com [10.36.112.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1C285C22A; Mon, 12 Oct 2020 08:14:43 +0000 (UTC) From: "Eelco Chaudron" To: "Sebastian Andrzej Siewior" Cc: "Juri Lelli" , tglx@linutronix.de, linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, bristot@redhat.com, williams@redhat.com, atheurer@redhat.com Subject: Re: [PATCH 5.9 RT] net: openvswitch: Fix using smp_processor_id() in preemptible code Date: Mon, 12 Oct 2020 10:14:42 +0200 Message-ID: <65BBD0B4-2A74-421A-BF81-357CD5F84747@redhat.com> In-Reply-To: <20201009154116.a4fcrrm7flxonidd@linutronix.de> References: <20201009124759.592550-1-juri.lelli@redhat.com> <20201009154116.a4fcrrm7flxonidd@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9 Oct 2020, at 17:41, Sebastian Andrzej Siewior wrote: > On 2020-10-09 14:47:59 [+0200], Juri Lelli wrote: >> This happens because openvswitch/flow_table::flow_lookup() accesses >> per-cpu data while being preemptible (and migratable). >> >> Fix it by adding get/put_cpu_light(), so that, even if preempted, the >> task executing this code is not migrated (operation is also guarded >> by >> ovs_mutex mutex). > > This warning is not limited to PREEMPT_RT it also present upstream > since > commit > eac87c413bf97 ("net: openvswitch: reorder masks array based on > usage") > > You should be able to reproduce it there, too. > The path ovs_flow_tbl_lookup() -> flow_lookup() is guarded by > ovs_lock() > I can't say that this true for > ovs_vport_receive() -> ovs_dp_process_packet() -> > ovs_flow_tbl_lookup_stats() -> flow_lookup() > > (means I don't know but it looks like coming from NAPI). > > Which means u64_stats_update_begin() could have two writers. This must > not happen. > There are two reader which do u64_stats_fetch_begin_irq(). Disabling > interrupts makes no sense since they perform cross-CPU access. > > -> You need to ensure that there is only one writer at a time. > > If mask_array gains a spinlock_t for writer protection then you can > acquire the lock prio grabbing ->masks_usage_cntr. But as of now there > is one `ma->syncp'. I’m not too familiar with the RT kernel, but in the none RT kernel, this function is called in run to completion parts only, hence does not need a lock. Actually, this was designed in such a way that it does not need a lock at all. So maybe this needs a get_cpu() instead of the light variant in the RT case? //Eelco