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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EC52C433F5 for ; Wed, 10 Nov 2021 11:08:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6901161205 for ; Wed, 10 Nov 2021 11:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbhKJLKz (ORCPT ); Wed, 10 Nov 2021 06:10:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40458 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbhKJLKt (ORCPT ); Wed, 10 Nov 2021 06:10:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636542481; 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=48dRn8RRnq7Fx6Bqaf9CAoNN40en8LqbHxW41Xnziw0=; b=dpWL7meooMgtBAmdDfRcE8M23Cvi9RojMiz0s6vfwne6xMgsHhy5yvRUBJSzSbnpT+vZE7 UtCi2D18EuXvv1RNmj8iYDIBbQ1c3dwPweBTrUq4Kyiep81DMsIqjoi0EQBaFMqGXHjyw5 9ddfqP0gd5Ejvqk0mMic57gjbIsJyWo= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-158-MH5B7MdMPXy1eakPG8K6eQ-1; Wed, 10 Nov 2021 06:08:00 -0500 X-MC-Unique: MH5B7MdMPXy1eakPG8K6eQ-1 Received: by mail-ed1-f70.google.com with SMTP id y20-20020a056402359400b003e28c9bc02cso2019889edc.9 for ; Wed, 10 Nov 2021 03:08:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=48dRn8RRnq7Fx6Bqaf9CAoNN40en8LqbHxW41Xnziw0=; b=R5DR3CELM0BbQOCsRAxVG9rnXAVxK/1JL7z8gMZ/3sQyMJmnIAsI6rAbq92dJP5h1K xnAJf2XO5Emu987nasGNBQfSBCdBQHbxN4UFKewhC8Bm8zvdx6LGUPTktqJzuB16h5a0 nDYc/qLKNh7DWTowO6XuEL/VckbeZ0SwQkpS8RAKDHEXBf+76XD8j4rUeI9fUWuage98 ylBGY15wO0LJ1yxgFm4rbYJpQ1nEvSYMzmHgfgfnJbzCqlipuHVNjoyzU6fRWFXfIg2u MfNPnMoT9hhehAECIVcZ26w/1vgNULQ3U1wVbwnBXJgk0jUtJG8yYCqLa0S8axnT+C0Y yhRA== X-Gm-Message-State: AOAM5310FNu4CbhW5ixlDeW/mSm1SADRaBpFcDe7mDDwehz5eI31Ijzq HUxgBptRo8vQeI+yYyISJySFf5MxXtcI1/E/WAlJEtkLY9NrbwNKfKYrgnDj/xfugo+Xpc7rkIF 62I6LgHUGBJrexwvxFGLvmriq X-Received: by 2002:a17:907:86a6:: with SMTP id qa38mr18779866ejc.286.1636542479466; Wed, 10 Nov 2021 03:07:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIY9E3GGXDTMKNhG94s7x2qpu4nLPlWqmcyoHulhCMNs+PGo9+5ZlP1mG10EA68G9ox4DyaA== X-Received: by 2002:a17:907:86a6:: with SMTP id qa38mr18779839ejc.286.1636542479231; Wed, 10 Nov 2021 03:07:59 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id g21sm9257171edb.89.2021.11.10.03.07.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Nov 2021 03:07:58 -0800 (PST) Message-ID: Date: Wed, 10 Nov 2021 12:07:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v3 01/16] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref Content-Language: en-US To: Sean Christopherson , Like Xu Cc: Peter Zijlstra , Will Deacon , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Morse , Alexandru Elisei , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Stefano Stabellini , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Artem Kashkanov , Zhu Lingshan , Juergen Gross , Ingo Molnar , Albert Ou , Palmer Dabbelt , Vincent Chen , Paul Walmsley , Greentime Hu , Boris Ostrovsky , Marc Zyngier , Nick Hu , Guo Ren , Mark Rutland , Arnaldo Carvalho de Melo References: <20210922000533.713300-1-seanjc@google.com> <20210922000533.713300-2-seanjc@google.com> <77e3a76a-016b-8945-a1d5-aae4075e2147@gmail.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/4/21 15:18, Sean Christopherson wrote: > If I'm interpeting Paolo's suggestion > correctly, he's pointing out that oustanding stores to the function pointers in > @cbs need to complete before assigning a non-NULL pointer to perf_guest_cbs, > otherwise a perf event handler may see a valid pointer with half-baked callbacks. > > I think smp_store_release() with a comment would be appropriate, assuming my > above interpretation is correct. > Yes, exactly. It should even be rcu_assign_pointer(), matching the synchronize_rcu() in patch 1 (and the change can be done in patch 1, too). Paolo