[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 1/1] xen: Use a global mapping for runstate


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 29 May 2020 08:15:59 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vrDXmiz0l+amY/5J1pxupmFOtEFDeXqRXqpOm0W35Ow=; b=Ussmmiov4wPp1r1exYFWvpt+fPtRNJB0aeSG4BSJFxDQWfGcN9k1l7kp+H2VOZqPeNnSHcLaHi12lYnsgi4LJ53HXitrWKzysN/Vc4L+YIs2uWv5GqbBDi3NoKqJJBGFQ5HF37Zjdg2e/kgBj1FjgJJQZHC8TBSJy9UzaZ+yn6k2bARLa2h220KkpGjCVHCAQfcRIL4ZpAZd8b1bzO8Ev862JV0CdnjhKVENw3NrKsHOFO3fTgFHlEzCOA0rX8g9aqZkTwzwMgymXXnet9wYsZmEDEh3kE0TcroWk6m1dWPGSoqqHh5T73wt5ZEXdP12risyGmOginV0V9LHEU39Tg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k8EeBOBxCZli9u71R5u+nBP1ixjI09HlMOf/AESpblf50scl0pC3QeMxpAVUWnp8UzikM7wDj1krUFTyzl2JhCeMEg6M8ilkCsu/1eW3gim+B2++COxViMKIub8Ht5ohvJ+ITgMPeRSQBlAFclevyeShYZAHc7QxtHnAw+Vo3+/JvLsUMQRdGSJJ9Z9gRsuWIxItkxhW9Exx+fIe8BqboaiW0nDGZZ4YktE52O0w2gjrhXBjPG599irp1akQncX2tKd7sEkucU8BzNkd0RK67QeZ+WryLfhv0q37R4mEiiouFUdP6ZxLYMyEvhC3fqkcRWtMay0SZKsEZr7j2xNqTQ==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxx>, nd <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 29 May 2020 08:16:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWNP6nIxIB/r3XC025DLnqIbmaJai9txeAgAAHJ4CAAB/EgIAA2sQA
  • Thread-topic: [RFC PATCH 1/1] xen: Use a global mapping for runstate


> On 28 May 2020, at 20:12, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi,
> 
> On 28/05/2020 18:19, Bertrand Marquis wrote:
>>>> +
>>>> +    return 0;
>>>> +}
>>>> +
>>>> int domain_kill(struct domain *d)
>>>> {
>>>>     int rc = 0;
>>>> @@ -727,7 +788,10 @@ int domain_kill(struct domain *d)
>>>>         if ( cpupool_move_domain(d, cpupool0) )
>>>>             return -ERESTART;
>>>>         for_each_vcpu ( d, v )
>>>> +        {
>>>> +            unmap_runstate_area(v, 0);
>>> 
>>> Why is it not appropriate here to hold the lock? It might not be
>>> technically needed, but still should work?
>> In a killing scenario you might stop a core while it was rescheduling.
>> Couldn’t a core be killed using a cross core interrupt ?
> 
> You can't stop a vCPU in the middle of the context switch. The vCPU can only 
> be scheduled out at specific point in Xen.

Ok

> 
>> If this is the case then I would need to do masked interrupt locking 
>> sections to prevent that case ?
> 
> At the beginning of the function domain_kill() the domain will be paused (see 
> domain_pause()). After this steps none of the vCPUs will be running or be 
> scheduled.
> 
> You should technically use the lock everywhere to avoid static analyzer 
> throwing a warning because you access variable with and without the lock. A 
> comment would at least be useful in the code if we go ahead with this.
> 
> As an aside, I think you want the lock to always disable the interrupts 
> otherwise check_lock() (this can be enabled with CONFIG_DEBUG_LOCKS only on 
> x86 though) will shout at you because your lock can be taken in both IRQ-safe 
> and IRQ-unsafe context.

Ok I understand that.
I will take the lock here.

Cheers
Bertrand


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.