Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1237565lqd; Thu, 25 Apr 2024 09:26:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVBVATo86iF5LEThKSOBPi96skRDlkBDM7w6ND1j6+pDL/sUFvPrI9ma10uUOL4e9Eo6BJZ2OlD7iifpcpkeH5Bc2YNyJJTM3+AoiMsg== X-Google-Smtp-Source: AGHT+IGDnZuAQSBz6JlmUVFDxKdWIFJ3I7CzasKv0CbFcewHJXbfdkliEtNaIsMLosPR7D/H3TZQ X-Received: by 2002:a17:902:7284:b0:1e5:a025:12f9 with SMTP id d4-20020a170902728400b001e5a02512f9mr10731pll.28.1714062379022; Thu, 25 Apr 2024 09:26:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714062379; cv=pass; d=google.com; s=arc-20160816; b=RROf3HPwoFSnAHAh3Y5xxj+rcZJr2nQIGBAgkXjwjbaZyzKp5TEvUSttXejK9bbxyc bVWyrt42Wacn2FWfA+l8zts28e0ihKJuBsVIO5iCF655c9dZkq51gpo3JebyglGL/xA2 vy74Kz/YldED7kjNHw3qKzoR5QbPzmgiXbhfNjeE5YhU49n+5Ysf+OwVBwAT07XEgswL gRjeBj9B2+8A+NhWt5cNEg1/ABUn1T+CNDN17mQh6vlOEmRVaeXplDT/Tm/ne+b6MbEo UWRUYhJkrZjh+vWdVHA/cPPQL8bs6mAngpr7NYlSpEcriq4MKb5T4GdGlSu5eaIr78j+ hi2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=EDuopDjXfunZvdvHof7XCisSrwKL98dOKzOYyljZ3x4=; fh=mj9NNUxG0FKP/NBUZJvu4BD9ro8PnyB9Ps0/4gr/oqo=; b=Qys1ARsYjQt8kFgjqmnbg2j4QDHcjif8jRsuvToeOMoeVqSqd9u1rFd0o9NzqboTCM 5hxcZ1ShJe4TjN4WtwOyVMrj3ayErvq1Ndbn+5c7q6ygYqUcygdcxF7XO4A27McJ7iCX g13w7QfojpmMfiFS/ZBf9QsI6beMJVFV2oULy6LI7kkFwGOPKDEpy3mPhNdSYaJurtSK /32vORdDowVZKBgAXJUVjIpqVG8M1zFxpjZ9SURPhlIf1h1ZVMVKME3Rb6jcEqsG4MKP +l1HA+LmRKaq80ROrz2wfqUm5tXO2m4GZnUCczrWwqdGnjKRdEjpRact9JpBkDhBNp+i VNRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=j934Hiki; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-158892-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158892-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d7-20020a170902854700b001e84273b12esi13271515plo.398.2024.04.25.09.26.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 09:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158892-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=j934Hiki; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-158892-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158892-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 27F892830D6 for ; Thu, 25 Apr 2024 16:26:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8979214D452; Thu, 25 Apr 2024 16:26:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="j934Hiki" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F4FA14D2A2 for ; Thu, 25 Apr 2024 16:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714062362; cv=none; b=TXwcjVJKNNkAV1gbb0cZTocBYferVGtYLK0kdK03Sg5S9icqiE9BXVxHsZ06jyX3R4QqMRdcjqoL/MMXFEfXZerO9Vr3agvQ+a6tZyu86OrYviBg25G9dfZoC4gWr2bkGhstuiBTiYAe/zZdi+e1XgvrV1mv9VtOH2/X+RCt4gk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714062362; c=relaxed/simple; bh=Wrp02xIa5F+jofcD0a3nI2LJ5ugmaidOo1ZiG5tjSKQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YzJt+WNDeml/thZrmELP5MwAPkjRbXBeM+rdce2pvvIZeonQrVlXxX/JlZtVOKV/D/jyIG96ohmaGkfxwrFQ8dAH5fzytlrE0rJegyud5cWnjD78OfD8g/bRhCt04USTy36bNBLwvpBWOeNA0qC+QadAhhi23oNX7sAxlrCk9WM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=j934Hiki; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-de58685682fso2323971276.2 for ; Thu, 25 Apr 2024 09:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714062360; x=1714667160; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=EDuopDjXfunZvdvHof7XCisSrwKL98dOKzOYyljZ3x4=; b=j934HikiskWI9FzAuCV0l4fRFCKeEc8A44gBigsUOWIZBXl8drAZZ1jdnQhLX6GWMH xI74oB1ConEdZp33R79AlkXf56kqVFZS7oJozQklwFosSMqMYLtiMJIQdWouxmHks4QN LP2xf9pT/uD8ug6pg15BH9+RWQ2O9xI28VNHCetLqM1/MzsqORAuuoznA/T3HgJ3sITs fHg9t6dOuiVfmzDiYvrhfKL0z1hoIBkghUkFY5SHX6Yp801eRvNxRNfls6Kusqjk7x62 64qb7p8dTLInqSJrNncX2cGGudC6TGv3i5zkQjMLnBMhV0ENCr12sI5eotAIZVfoKZL2 7IeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714062360; x=1714667160; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EDuopDjXfunZvdvHof7XCisSrwKL98dOKzOYyljZ3x4=; b=gc5ctlXVM0Vs2GRq/dVR4TfJZarA2lcOHrtV1k4V04JVTbDJ2xGeRIel0DVYjHj2wh o0+RWoelm29FQplkmR0dDc8BvYbVo18xp9saRTH5kfVpOgNVKyiNuXGFavAU+hy3yhEO XGjDudpt+u72CapMMsvKQS5hTNrtnZUwYBqtXnT6DnRl2c1oQMO+ur5UBgBu2t7Tq0QP bW5Zc9sZo2TokUJ+qQpy1nrnJXzfdqOGn7+72ZXnnibEuoh+NjlePdAGw8/HDuM+SDrg eHWSrGfR69cR92+3PgOTo+TCfP6dZhYYiTLQFIrPcuSZLcBRtTMjYWp8/AhzhBzg2gNP /8Gg== X-Forwarded-Encrypted: i=1; AJvYcCWtIwYB5XF+dTYlGodnaSfYcC50iUTz9w93vvP/2KCZ0xQJOt3BEU24djmMnVLR1qPTS6/NhtSO0cKjB6yFdbrtzTxI4p/t31rTmlL3 X-Gm-Message-State: AOJu0YzAFeQnjFaGFX5iaJCqT1uo6dGpQZ22vxtR7jg3llSpCe6cbbNE zWdAulqsJh4Wyy1fi86nJ70B9rVHFgrxsGp5XPmdeGgYmJu0H29/4oXCJtNAJpRVd9Zbuk9uYwE vrQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:8052:0:b0:de1:d49:7ff6 with SMTP id a18-20020a258052000000b00de10d497ff6mr4364ybn.7.1714062360352; Thu, 25 Apr 2024 09:26:00 -0700 (PDT) Date: Thu, 25 Apr 2024 09:25:58 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240423073952.2001989-1-chentao@kylinos.cn> <878bf83c-cd5b-48d0-8b4e-77223f1806dc@web.de> <20240423-0db9024011213dcffe815c5c@orel> <20240424-e31c64bda7872b0be52e4c16@orel> Message-ID: Subject: Re: [PATCH] KVM: selftests: Add 'malloc' failure check in test_vmx_nested_state From: Sean Christopherson To: Oliver Upton Cc: Andrew Jones , Markus Elfring , Kunwu Chan , linux-kselftest@vger.kernel.org, kvm@vger.kernel.org, kernel-janitors@vger.kernel.org, Muhammad Usama Anjum , Paolo Bonzini , Shuah Khan , LKML , Kunwu Chan , Anup Patel , Thomas Huth Content-Type: text/plain; charset="us-ascii" On Wed, Apr 24, 2024, Oliver Upton wrote: > Hey, > > On Wed, Apr 24, 2024 at 07:51:44AM -0700, Sean Christopherson wrote: > > On Wed, Apr 24, 2024, Andrew Jones wrote: > > > On Tue, Apr 23, 2024 at 12:15:47PM -0700, Sean Christopherson wrote: > > > ... > > > > I almost wonder if we should just pick a prefix that's less obviously connected > > > > to KVM and/or selftests, but unique and short. > > > > > > > > > > How about kvmsft_ ? It's based on the ksft_ prefix of kselftest.h. Maybe > > > it's too close to ksft though and would be confusing when using both in > > > the same test? > > > > I would prefer something short, and for whatever reason I have a mental block > > with ksft. I always read it as "k soft", which is completely nonsensical :-) > > I despise brevity in tests, so my strong preference is to use some form > of 'namespaced' helper. Perhaps others have better memory than > I do, but I'm quick to forget the selftests library and find the more > verbose / obvious function names helpful for jogging my memory. Hmm, I generally agree, but in this case I think there's value in having the names *not* stand out, because they really are uninteresting and would ideally blend in. I can't envision a scenario where we don't want to assert on an OOM, i.e. there should never be a need to use a raw malloc(), and so I don't see much value in making it obvious that the call sites are doing something special. > > > I'm not a huge fan of capital letters, but we could also do something like > > > MALLOC()/CALLOC(). > > > > Hmm, I'm not usually a fan either, but that could actually work quite well in this > > case. It would be quite intuitive, easy to visually parse whereas tmalloc() vs > > malloc() kinda looks like a typo, and would more clearly communicate that they're > > macros. > > Ooo, don't leave me out on the bikeshedding! How about TEST_MALLOC() / > TEST_CALLOC(). It is vaguely similar to TEST_ASSERT(), which I'd hope > would give the impression that an assertion is lurking below. Yeah, but it could also give the false impression that the macro does something fancier, e.g. this makes me want to peek at TEST_MALLOC() to see what it's doing cpuid = TEST_MALLOC(kvm_cpuid2_size(nr_entries)); whereas this isn't quite enough to pique my curiosity. cpuid = MALLOC(kvm_cpuid2_size(nr_entries)); So I have a slight preference for just MALLOC()/CALLOC(), but I'm also ok with a TEST_ prefix, my brain can adapt. One of those two flavors has my vote.