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

Re: [PATCH v2] xen: rework error handling in vcpu_create


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Tue, 5 Aug 2025 05:33:20 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dT/4jGGRjeikvtWrxMaVrECdpK9ZcZ5gGPvi3qVuHDg=; b=anyOmx47A7AQSTDZt1japCKh5GilMlbDTmZRXe0H4JW1p5VPLMf34lHUg9Dxyfx1YQgh1RfgOW/3VPnHyZ/dg7jGT1XEdttYwVLK5W281/63yoMEMMWzcRo+H6k7IWUiSEko5sbtIo/3IEJT7wocTVTN3u+ZWs4C5Dq81HEMc6nx+fuqkJu7FE0SGDrhKOLz6r4MlCtCXDoKQc5WrnoHe0aouEJEbCQtinhJSmPwoceTk6+gqhofDkAPv/kN6bAyGQOZpz9C/Y+GW0oZMi6aejUoP7EpIfsIHsp8R7oM85sQBITOjWHopplTbKjEGNPTL8I2o8/uFD75mti86KraLQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gttRFNHNlv1mMANa96YWew2RPUrKOJ7iPhulFy7ii1LXerhvqmc86bIZCwfN4CNOgasBtR3pJ0Z1tBaxZ6no1Co/5bKQHkeLZ2toogCSLjY7IOXcfMAGfPhI0FlgBSeaoJ7tkz1tQiy4J5gGH8PZh+RnzShafcUTrPENlD7vvsPbmNAd/48v75qtle0ey+H50/lEWF917qg1kLxwoV0YkmWVcOQuqbACmEmpAOe1Y87Urd7ZOS6jdh7qZtEY3fRDK59fEBhgsT3QSV+y7imXH8oYdqSyRrh2A7D8hBDUXyAkS5FmQtD9vpODTWUdMhacgRhRkG+fGCYyidVn7Tmazw==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Dario Faggioli" <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "George Dunlap" <gwd@xxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 05 Aug 2025 09:33:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 8/5/25 05:17, Jan Beulich wrote:
> On 05.08.2025 11:06, Stewart Hildebrand wrote:
>> On 8/5/25 03:44, Jan Beulich wrote:
>>> On 04.08.2025 18:57, Stewart Hildebrand wrote:
>>>> On 8/4/25 03:57, Jan Beulich wrote:
>>>>> On 01.08.2025 22:24, Stewart Hildebrand wrote:
>>>>>> @@ -839,6 +839,9 @@ void sched_destroy_vcpu(struct vcpu *v)
>>>>>>  {
>>>>>>      struct sched_unit *unit = v->sched_unit;
>>>>>>  
>>>>>> +    if ( !unit )
>>>>>> +        return;
>>>>>> +
>>>>>>      kill_timer(&v->periodic_timer);
>>>>>>      kill_timer(&v->singleshot_timer);
>>>>>>      kill_timer(&v->poll_timer);
>>>>>
>>>>> What if it's the 2nd error path in sched_init_vcpu() that is taken?
>>
>> ^^ This ^^ is what I'm confused about
> 
> If sched_init_vcpu() took the indicated path,

What path? In the one I'm looking at, sched_free_unit() gets called,
setting v->sched_unit = NULL, and in that case ...

> the if() you add here won't
> help, and ...

... the condition is true, and ...

>>>>> Then we
>>>>> might take this path (just out of context here)
>>>>>
>>>>>     if ( unit->vcpu_list == v )
>>>>>     {
>>>>>         rcu_read_lock(&sched_res_rculock);
>>>>>
>>>>>         sched_remove_unit(vcpu_scheduler(v), unit);
>>>>>         sched_free_udata(vcpu_scheduler(v), unit->priv);
>>>>>
>>>>> and at least Credit1's hook doesn't look to be safe against being passed 
>>>>> NULL.
>>>>> (Not to speak of the risk of unit->priv being used elsewhere while 
>>>>> cleaning
>>>>> up.)
>>>>
>>>>
>>>> Are you referring to this error path in sched_init_vcpu?
>>>
>>> No, given the context I thought it was clear that I was referring to
>>>
>>> static void cf_check
>>> csched_free_udata(const struct scheduler *ops, void *priv)
>>> {
>>>     struct csched_unit *svc = priv;
>>>
>>>     BUG_ON( !list_empty(&svc->runq_elem) );
> 
> ... we'd make it here (afaict).

... we'd not make it here.



 


Rackspace

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