Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2741558pxb; Sat, 6 Feb 2021 06:22:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHhWcUYkPZAcrWPCfEGSLpb2VEsftU0RyPUBWiz/+NQst4TKZnWroCApGHgEZxr7miLmxX X-Received: by 2002:a17:907:d86:: with SMTP id go6mr2808920ejc.337.1612621337660; Sat, 06 Feb 2021 06:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612621337; cv=none; d=google.com; s=arc-20160816; b=taMPLd2XdDAumE1Bzeg7/sOG5lcCN5d/6GVh7ZjxnWSyMx/9ynYv9DoD7DSTp2Mh97 H3/492QAeSUZEZm04XD3TeCMy/cnSqMDDfV9NHAUkgxX6lFbdFumuGJzYmgYqicc+AxQ iC16zi2XmOxowXmcLRfTb+x/l7pnJalVAGzh4R0LYnZvnrC/arASSPkF1NYS6NCfZXBH Qqd371Z8tQJAuUPPZT4CiTnLtoJY/TF9VjGJtDoCxlXqE0vUsXXiR0ApHJyTNTU3RZ1C UaiBCIuZb5rtCl1N5Lz7TKu3nY7UJ0DsSOJEs1QMRkqSZeWDl6rcekH66y1eMcwazbo5 h+bw== 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=e3DoAeL+lOAUxA+lEznGlmmjujWcwFYkHH+iAB3YFd8=; b=UC8yztzyPAmns4OJkd+LBn2zv7t+9p4Qf8Jjt68Rscdn3HEHNqC7eiArwUiBsK2MP/ EiB3oZFUg6YQEBZcaiA6uGMWujgdoteKFEEU59aWfqvRT2sW0JDefAi6rDQAhNvjWv5D kqRulSZabUBtWAZ5uMLx7f03SwWAR7I3DDmBkPAaJp6fUkPGKgwmLYMczSZfgg3Nb3dw cxehROf3VInV+/UstJ+ExS0y+29kdUlVDUwA2JSA0D8MOzZXp2/Sh+tbxMchRji3AZWU tup2TWejymllc+LsOfInuQuhOmDCV9MhMPUJERj5g7jRjOj+ukV35ZbwDR+f76abHp7H xQ9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=4rbcp6mG; 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 uz29si7248275ejb.527.2021.02.06.06.21.39; Sat, 06 Feb 2021 06:22:17 -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=4rbcp6mG; 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 S229807AbhBFMUN (ORCPT + 99 others); Sat, 6 Feb 2021 07:20:13 -0500 Received: from mail.xenproject.org ([104.130.215.37]:55014 "EHLO mail.xenproject.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhBFMUM (ORCPT ); Sat, 6 Feb 2021 07:20:12 -0500 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=e3DoAeL+lOAUxA+lEznGlmmjujWcwFYkHH+iAB3YFd8=; b=4rbcp6mGnnPqoWsQ2dSADRlhJb msnMqOlsGoUcFiM4mmlsLdcW1GDhMQWw3xTBjBDyrmdIykTolAfFqm0lCx6QRYuMm6byzvsQJiYqV wT+UBehO42aD2R0/DbrTJ8fOjw5qAU5VJKeFbkcCX4w3szma0Ec/mtfb7bXPXkNa+YKU=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l8MYf-0008BZ-0C; Sat, 06 Feb 2021 12:19:25 +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 1l8MYe-0005pl-Ml; Sat, 06 Feb 2021 12:19:24 +0000 Subject: Re: [PATCH 1/7] xen/events: reset affinity of 2-level event initially To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= , 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 12:19:22 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/02/2021 12:09, Jürgen Groß wrote: > On 06.02.21 12:20, Julien Grall wrote: >> 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? > > This would need another callback. Right, this seems to be better than walking over all the CPUs every time just for cleaning one bit. Cheers, -- Julien Grall