Re: [kvm-unit-tests PATCH v4 2/2] s390x: sclp: Implement SCLP_RC_INSUFFICIENT_SCCB_LENGTH

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

 




On 5/30/23 17:35, Claudio Imbrenda wrote:
On Tue, 30 May 2023 14:52:43 +0200
Pierre Morel <pmorel@xxxxxxxxxxxxx> wrote:

If SCLP_CMDW_READ_SCP_INFO fails due to a short buffer, retry
with a greater buffer.
the idea is good, but I wonder if the code can be simplified (see below)

Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
---
  lib/s390x/sclp.c | 58 +++++++++++++++++++++++++++++++++++++++++-------
  1 file changed, 50 insertions(+), 8 deletions(-)

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 34a31da..9d51ca4 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -17,13 +17,14 @@
  #include "sclp.h"
  #include <alloc_phys.h>
  #include <alloc_page.h>
+#include <asm/facility.h>
extern unsigned long stacktop; static uint64_t storage_increment_size;
  static uint64_t max_ram_size;
  static uint64_t ram_size;
-char _read_info[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
+char _read_info[2 * PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
this is ok ^

[skip everything else]

  void sclp_read_info(void)
  {
-	sclp_read_scp_info((void *)_read_info, SCCB_SIZE);
	sclp_read_scp_info((void *)_read_info,
		test_facility(140) ? sizeof(_read_info) : SCCB_SIZE;

+	sclp_read_scp_info((void *)_read_info);
  	read_info = (ReadInfo *)_read_info;
  }

You are right, no need to begin with a short buffer if we can go with a big one at first try.

I take it

thx






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux