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

Re: [PATCH 1/2] xenalyze: Handle start-of-day ->RUNNING transitions


  • To: George Dunlap <george.dunlap@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 27 Apr 2023 21:28:14 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zcYwePm3wqF18F67BMAPfo29HOUiUXQw1Vx6vSXGZpo=; b=A4kFpDvhJc+nfd1hxhBh2dv92tHILIqh/YhTfw7HtBR57xQJFzfuf71XBSMpFwrPQPsOlRx1DuaRNDwqA7O938tqXxDvGyVcUUh/u3DreKQTCkYBbHKvb4As3k/MZXPVRxFPheG/HbkGP9XeAbnxaJB24dxs9Vcv/7KwfSfDyos2tQJN95qr2RtlM/F1CePcNqfCczD+vKbm+2qdL98XkGaSztossak5fo9OIXCR8ansVrAxvEmZ0atx9wY0WMdVmFxie2/FAnLDKOJAqrBI0Jt81p5g0i34dk3AT7GJmbvl+Q1qTDIB+MkworhUT2TOZYgzkKMR4FCDBzijscbh4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hhvpZMGzBhhd1MQyTX1UozOHyl8FqeoJZ5oDN5a2Qz9VLNQ/SDbJBEx3PN6r+6eyONteRHokqd3xC6eoJjVtEfweZfx0rkeFlpjHCivPAuSlN3PHUenLu8BtalFq9QaaZXEUm0ks5RY9JBQPY+I1cQU7vguOOspPP2pCDqQRVgGKIlD9R2fgA4VQZGwR2w5TmICmkb/V0Ksc9kTYLLNuirwUnMujwOLaMdelqNwTqGV+vBXMfwV0Qoi9FJA572Zn3HmyMe1HgL3sNzXZd1fvyxpl8ZtfgdmKXD9pWdTIFBQAcr3oHIxvp4HxqvML5HUUCqJ/kYblXPQlgXV1YOSWeg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Anthony Perard <anthony.perard@xxxxxxxxx>, Wei Liu <wl@xxxxxxxxxxxxxx>
  • Delivery-date: Thu, 27 Apr 2023 20:28:47 +0000
  • Ironport-data: A9a23:MwD6NaLLptf9nr5qFE+RBJQlxSXFcZb7ZxGr2PjKsXjdYENS0mNUy jAaWWuHPancZ2L0fo8jad/nphlV7ZfUyNdrGwRlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPSwP9TlK6q4mhA4gZhPasjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5GP2xDx 78acQkTb0CjrN+m4amJZfdV05FLwMnDZOvzu1lG5BSAVbMMZ8+GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/VvpTGLk2Sd05C0WDbRUvWMSd9YgQCzo WXe8n6iKhobKMae2XyO9XfEaurnxHukAd9PReLjnhJsqGS570MMIkQ0bnCYq/2wqh7gVNlzJ 0NBr0LCqoB3riRHVOLVUBC/unGJ+BIBXd5ZC8Ux7AaQxuzf5APxLngJSHtNZcIrsOcyRCc2z RmZktXxHzttvbaJD3WH+d+8pDWuOS8TPCkaaDUNVwct6N3kvY11hRXKJv58FIalg9vtAzbyz juW6i8kiN0uYdUj0qy6+RXNhW2qr52QFgotvFyPASSi8x9zY5Oja8qw81/H4P1cLYGfCF6co HwDnMvY5+cLZX2QqBGwrCw2NOnBz5643Pf02AQH80UJn9h1x0OeQA==
  • Ironport-hdrordr: A9a23:1tBjx65DgGbY444CJAPXwa6CI+orL9Y04lQ7vn2ZFiY5TiXIra qTdaogviMc6Ax/ZJjvo6HnBEDyewK5yXcT2/htAV7CZnidhILMFu1fBOTZsl7d8kHFh5ZgPO JbAtND4b7LfCZHZKTBgDVQeuxIqLfnzEnrv5am854Ed3AUV0gK1XYdNu/0KDwQeOALP+taKH LKjfA32wZINE5nJ/iTNz0gZazuttfLnJXpbVovAAMm0hCHiXeF+aP3CB+R2zYZSndqza05+W bIvgTl7uH72svLhyP05iv21dB7idHhwtxMCIiljdUUECzljkKFdZlsQLqLuREyuaWK5EwxmN fBjh88N4BY6m/XfEuyvRzxsjOQmgoG2jvH8xu1kHHjqcv2SHYTDNdAv5tQdl/851A7tN9x/a pX1ybB3qAnRi/orWDY3ZzlRhtqnk27rT4LlvMStWVWVc87ZKVKpYIS0UtJGNMrHT786qogDO 5yZfusrMp+QBe/VTT0r2NvyNujUjAaGQqHeFELvoiv3z1fjBlCvj8l7f1auk1F2IM2SpFC6e iBGL9vjqtyQsgfar84LPsdQOOsY1a9AC7kASa3GxDKBasHM3XCp9rc+7Mu/tynf5QO0d8bhI nBalVFrmQ/EnieR/Fm5Kc7sSwlfV/NHwgEkqpllt1EU/zHNfXW2BS4ORATe5DKmYRaPiXZM8 zDTa6+TcWTalcGIrw5rDEWa6MiWEX2b/dlyurTe2j+1f4jebeawNDzQbL0GIfHNwoCdyfWPk YjNQKDVvmoqHrbFkPFvA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27/03/2023 5:13 pm, George Dunlap wrote:
> A recent xentrace highlighted an unhandled corner case in the vcpu
> "start-of-day" logic, if the trace starts after the last running ->
> non-running transition, but before the first non-running -> running
> transition.  Because start-of-day wasn't handled, vcpu_next_update()
> was expecting p->current to be NULL, and tripping out with the
> following error message when it wasn't:
>
> vcpu_next_update: FATAL: p->current not NULL! (d32768dv$p, runstate 
> RUNSTATE_INIT)
>
> where 32768 is the DEFAULT_DOMAIN, and $p is the pcpu number.
>
> Instead of calling vcpu_start() piecemeal throughout
> sched_runstate_process(), call it at the top of the function if the
> vcpu in question is still in RUNSTATE_INIT, so that we can handle all
> the cases in one place.
>
> Sketch out at the top of the function all cases which we need to
> handle, and what to do in those cases.  Some transitions tell us where
> v is running; some transitions tell us about what is (or is not)
> running on p; some transitions tell us neither.
>
> If a transition tells us where v is now running, update its state;
> otherwise leave it in INIT, in order to avoid having to deal with TSC
> skew on start-up.
>
> If a transition tells us what is or is not running on p, update
> p->current (either to v or NULL).  Otherwise leave it alone.
>
> If neither, do nothing.
>
> Reifying those rules:
>
> - If we're continuing to run, set v to RUNNING, and use p->first_tsc
>   as the runstate time.
>
> - If we're starting to run, set v to RUNNING, and use ri->tsc as the
>   runstate time.
>
> - If v is being deschedled, leave v in the INIT state to avoid dealing
>   with TSC skew; but set p->current to NULL so that whatever is
>   scheduled next won't trigger the assert in vcpu_next_update().
>
> - If a vcpu is waking up (switching from one non-runnable state to
>   another non-runnable state), leave v in INIT, and p in whatever
>   state it's in (which may be the default domain, or some other vcpu
>   which has already run).
>
> While here, fix the comment above vcpu_start; it's called when the
> vcpu state is INIT, not when current is the default domain.
>
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxx>

Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>



 


Rackspace

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