Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2659208pxb; Sat, 6 Feb 2021 03:52:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9OC/RcU+ioyJZCoTL4/zzT+oi+8THLcbwqCV1TilhpiWZG66CdnnuiXe3H0Hc0YycQ6wZ X-Received: by 2002:aa7:cb0d:: with SMTP id s13mr7969958edt.221.1612612357828; Sat, 06 Feb 2021 03:52:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612612357; cv=none; d=google.com; s=arc-20160816; b=lX8Fgv9/cKiGz+H3IBSWg5p4+3K+ow4MlTq38AFmHkig830bgLzU3ylWhu+6vqNIZd /NBL3rtWigHtlfsmKjUVeWh0sW+6JB82jt1z9Ke4op6lfc3dAF98gxpTEGJmWe4Y6sf3 qy/r3WVwIbfxb13xsUJAwsTgDt5T+Rq0CdM5UxT0BKD4cJbFcOuNlLw+nCsVVaJFyFAC 4G1A3oKcVc91e2EhN4O6jwT1Vt7LYfqQMLnMDvws5Jn4b13u3Zbbl9Pd9UGY2TZ6RyoH ByJNXnmQlFE1g/PuO+Qrs+jIi4/9riXHJL1OJ85CVuqVwdtTvMuKtBDr0f6ngtzT30UP QZRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=cQMVVJSJD0Yb9XwMSYFH2sar2ohLPP0jLc971S/sMZo=; b=dbVzlHDwVZusHu9jCRBgUN3p6boTMSym61D+7mWSPy155nqlc7VGOnZi2SAprjYzOJ MLw/1hvV3tWxz6pi2PhwmGM6KPE7/wng9dE1FpIk6M/oR/ydSI8alq4O95xp4KwIOeQV YWJMY1aBDQ6m1DpAXXc9Pn5YiJ2IWqtR6NbYaPh0mwOyhPzJblINN6v2v0+Ojx76rcMU B7x8ThB6u+m+6gTGg7zP5r1wwN/pYM+RHwXBXoA5KUIUF2Ogp2f9Wi+txsEC33TPBrAz s1/Zn9270SmOLbCbKAAkh9qUoXPQI791LuqABqW8KPUyP7gdQup3FvT94PT5JiUg5N0s aGTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=ffsul8eG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si4697518edr.342.2021.02.06.03.52.13; Sat, 06 Feb 2021 03:52:37 -0800 (PST) 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=@xen.org header.s=20200302mail header.b=ffsul8eG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbhBFLtx (ORCPT + 99 others); Sat, 6 Feb 2021 06:49:53 -0500 Received: from mail.xenproject.org ([104.130.215.37]:54978 "EHLO mail.xenproject.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbhBFLtq (ORCPT ); Sat, 6 Feb 2021 06:49:46 -0500 X-Greylist: delayed 1720 seconds by postgrey-1.27 at vger.kernel.org; Sat, 06 Feb 2021 06:49:46 EST DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=cQMVVJSJD0Yb9XwMSYFH2sar2ohLPP0jLc971S/sMZo=; b=ffsul8eGaVzjXDWs7EhAD5EEVQ uJn1mS8YMhPvBFddMAHUIXJCNzkhcLZqkJH+YtdQ17z4s3/BDSWyZlFmJ/sb7QnX1sPMn0cAoqMMf tH7LPW55otKCCBIBm8Yhdue3YtzZoFlozVtvzCTF9e+OrAvDEMqKM5+fiT3jmHR5uq3s=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l8LdS-0007F2-Ew; Sat, 06 Feb 2021 11:20:18 +0000 Received: from [54.239.6.185] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l8LdS-0001vv-5l; Sat, 06 Feb 2021 11:20:18 +0000 Subject: Re: [PATCH 1/7] xen/events: reset affinity of 2-level event initially To: Juergen Gross , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Boris Ostrovsky , Stefano Stabellini , stable@vger.kernel.org References: <20210206104932.29064-1-jgross@suse.com> <20210206104932.29064-2-jgross@suse.com> From: Julien Grall Message-ID: Date: Sat, 6 Feb 2021 11:20:16 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210206104932.29064-2-jgross@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Juergen, On 06/02/2021 10:49, Juergen Gross wrote: > When creating a new event channel with 2-level events the affinity > needs to be reset initially in order to avoid using an old affinity > from earlier usage of the event channel port. > > The same applies to the affinity when onlining a vcpu: all old > affinity settings for this vcpu must be reset. As percpu events get > initialized before the percpu event channel hook is called, > resetting of the affinities happens after offlining a vcpu (this is > working, as initial percpu memory is zeroed out). > > Cc: stable@vger.kernel.org > Reported-by: Julien Grall > Signed-off-by: Juergen Gross > --- > drivers/xen/events/events_2l.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c > index da87f3a1e351..23217940144a 100644 > --- a/drivers/xen/events/events_2l.c > +++ b/drivers/xen/events/events_2l.c > @@ -47,6 +47,16 @@ static unsigned evtchn_2l_max_channels(void) > return EVTCHN_2L_NR_CHANNELS; > } > > +static int evtchn_2l_setup(evtchn_port_t evtchn) > +{ > + unsigned int cpu; > + > + for_each_online_cpu(cpu) > + clear_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, cpu))); The bit corresponding to the event channel can only be set on a single CPU. Could we avoid the loop and instead clear the bit while closing the port? Cheers, -- Julien Grall